diff --git a/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java b/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java index e2a2a6c477..bbe44e4b45 100644 --- a/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java +++ b/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.auth; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.auth; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.Map; @@ -38,7 +38,7 @@ public class AllowAllAuthenticator implements IAuthenticator { return USER; } - + public void validateConfiguration() throws ConfigurationException { // pass diff --git a/src/java/org/apache/cassandra/auth/AllowAllAuthority.java b/src/java/org/apache/cassandra/auth/AllowAllAuthority.java index c2622da937..f41e00f943 100644 --- a/src/java/org/apache/cassandra/auth/AllowAllAuthority.java +++ b/src/java/org/apache/cassandra/auth/AllowAllAuthority.java @@ -1,6 +1,6 @@ package org.apache.cassandra.auth; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.auth; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.EnumSet; diff --git a/src/java/org/apache/cassandra/auth/AuthenticatedUser.java b/src/java/org/apache/cassandra/auth/AuthenticatedUser.java index ccd5b4b0c4..846810fb9a 100644 --- a/src/java/org/apache/cassandra/auth/AuthenticatedUser.java +++ b/src/java/org/apache/cassandra/auth/AuthenticatedUser.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.auth; diff --git a/src/java/org/apache/cassandra/auth/IAuthenticator.java b/src/java/org/apache/cassandra/auth/IAuthenticator.java index 113a646754..05e034fe5e 100644 --- a/src/java/org/apache/cassandra/auth/IAuthenticator.java +++ b/src/java/org/apache/cassandra/auth/IAuthenticator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.auth; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.auth; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.Map; diff --git a/src/java/org/apache/cassandra/auth/IAuthority.java b/src/java/org/apache/cassandra/auth/IAuthority.java index 99bc49aace..09ae175401 100644 --- a/src/java/org/apache/cassandra/auth/IAuthority.java +++ b/src/java/org/apache/cassandra/auth/IAuthority.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.auth; @@ -29,7 +29,7 @@ import org.apache.cassandra.config.ConfigurationException; /** * Cassandra's resource hierarchy looks something like: * {{/cassandra/keyspaces/$ks_name/...}} - * + * * In table form: * /cassandra/ * - no checked permissions @@ -44,11 +44,11 @@ import org.apache.cassandra.config.ConfigurationException; * - String * * An individual keyspace: READ/WRITE permissions apply to the entire namespace and control the ability to both * view and manipulate column families, and to read and write the data contained within. - * + * * Over time Cassandra _may_ add additional authorize calls for resources higher or lower in the hierarchy and * IAuthority implementations should be able to handle these calls (although many will choose to ignore them * completely). - * + * * NB: {{/cassandra/}} will not be checked for permissions via a call to IAuthority.authorize, so IAuthority * implementations can only deny access when a user attempts to access an ancestor resource. */ @@ -57,7 +57,7 @@ public interface IAuthority /** * @param user An authenticated user from a previous call to IAuthenticator.authenticate. * @param resource A List of Objects containing Strings and byte[]s: represents a resource in the hierarchy - * described in the Javadocs. + * described in the Javadocs. * @return An AccessLevel representing the permissions for the user and resource: should never return null. */ public EnumSet authorize(AuthenticatedUser user, List resource); diff --git a/src/java/org/apache/cassandra/auth/Permission.java b/src/java/org/apache/cassandra/auth/Permission.java index e968bac859..4e48539cbe 100644 --- a/src/java/org/apache/cassandra/auth/Permission.java +++ b/src/java/org/apache/cassandra/auth/Permission.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.auth; diff --git a/src/java/org/apache/cassandra/auth/Resources.java b/src/java/org/apache/cassandra/auth/Resources.java index 06ff3bbf60..4fc03c7d2f 100644 --- a/src/java/org/apache/cassandra/auth/Resources.java +++ b/src/java/org/apache/cassandra/auth/Resources.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.auth; diff --git a/src/java/org/apache/cassandra/cache/AutoSavingCache.java b/src/java/org/apache/cassandra/cache/AutoSavingCache.java index a6056907dd..e2901a7947 100644 --- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java +++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java @@ -52,7 +52,7 @@ public class AutoSavingCache extends InstrumentingCache saveTask; protected final CacheService.CacheType cacheType; - + public AutoSavingCache(ICache cache, CacheService.CacheType cacheType) { super(cache); diff --git a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java index 4b5a7954a1..8f4d2f02cf 100644 --- a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java +++ b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCache.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.Set; diff --git a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java index 4352e12fd0..851d4c5f13 100644 --- a/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java +++ b/src/java/org/apache/cassandra/cache/ConcurrentLinkedHashCacheProvider.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import org.apache.cassandra.db.ColumnFamily; diff --git a/src/java/org/apache/cassandra/cache/FreeableMemory.java b/src/java/org/apache/cassandra/cache/FreeableMemory.java index 52189c849b..0df1a6a407 100644 --- a/src/java/org/apache/cassandra/cache/FreeableMemory.java +++ b/src/java/org/apache/cassandra/cache/FreeableMemory.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.concurrent.atomic.AtomicInteger; diff --git a/src/java/org/apache/cassandra/cache/ICache.java b/src/java/org/apache/cassandra/cache/ICache.java index e0d0faf5f5..48e045c249 100644 --- a/src/java/org/apache/cassandra/cache/ICache.java +++ b/src/java/org/apache/cassandra/cache/ICache.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/cache/IRowCacheProvider.java b/src/java/org/apache/cassandra/cache/IRowCacheProvider.java index 3411350baf..9209ced4ef 100644 --- a/src/java/org/apache/cassandra/cache/IRowCacheProvider.java +++ b/src/java/org/apache/cassandra/cache/IRowCacheProvider.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import org.apache.cassandra.db.ColumnFamily; diff --git a/src/java/org/apache/cassandra/cache/InstrumentingCache.java b/src/java/org/apache/cassandra/cache/InstrumentingCache.java index a3c34ae6ad..36630ac97c 100644 --- a/src/java/org/apache/cassandra/cache/InstrumentingCache.java +++ b/src/java/org/apache/cassandra/cache/InstrumentingCache.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.Set; diff --git a/src/java/org/apache/cassandra/cache/SerializingCache.java b/src/java/org/apache/cassandra/cache/SerializingCache.java index b9506ac8db..b8844cb91a 100644 --- a/src/java/org/apache/cassandra/cache/SerializingCache.java +++ b/src/java/org/apache/cassandra/cache/SerializingCache.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -45,7 +45,7 @@ public class SerializingCache implements ICache { private static final Logger logger = LoggerFactory.getLogger(SerializingCache.class); private static final int DEFAULT_CONCURENCY_LEVEL = 64; - + private final ConcurrentLinkedHashMap map; private final ISerializer serializer; diff --git a/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java b/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java index af653213ef..f71684b6c7 100644 --- a/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java +++ b/src/java/org/apache/cassandra/cache/SerializingCacheProvider.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import org.apache.cassandra.db.ColumnFamily; diff --git a/src/java/org/apache/cassandra/cli/CliClient.java b/src/java/org/apache/cassandra/cli/CliClient.java index f9bbd42d6f..a4641b6bad 100644 --- a/src/java/org/apache/cassandra/cli/CliClient.java +++ b/src/java/org/apache/cassandra/cli/CliClient.java @@ -187,7 +187,7 @@ public class CliClient sessionState.out.println(getHelp().banner); } - // Execute a CLI Statement + // Execute a CLI Statement public void executeCLIStatement(String statement) throws CharacterCodingException, TException, TimedOutException, NotFoundException, NoSuchFieldException, InvalidRequestException, UnavailableException, InstantiationException, IllegalAccessException, ClassNotFoundException, SchemaDisagreementException { Tree tree = CliCompiler.compileQuery(statement); @@ -301,14 +301,14 @@ public class CliClient CliMain.disconnect(); System.exit(0); } - + public KsDef getKSMetaData(String keyspace) throws NotFoundException, InvalidRequestException, TException { // Lazily lookup keyspace meta-data. if (!(keyspacesMap.containsKey(keyspace))) keyspacesMap.put(keyspace, thriftClient.describe_keyspace(keyspace)); - + return keyspacesMap.get(keyspace); } @@ -342,9 +342,9 @@ public class CliClient String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec, keyspacesMap.get(keySpace).cf_defs); int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec); - + ColumnParent colParent = new ColumnParent(columnFamily).setSuper_column((ByteBuffer) null); - + if (columnSpecCnt != 0) { Tree columnTree = columnFamilySpec.getChild(2); @@ -362,8 +362,8 @@ public class CliClient int count = thriftClient.get_count(getKeyAsBytes(columnFamily, columnFamilySpec.getChild(1)), colParent, predicate, consistencyLevel); sessionState.out.printf("%d columns%n", count); } - - private void executeDelete(Tree statement) + + private void executeDelete(Tree statement) throws TException, InvalidRequestException, UnavailableException, TimedOutException { if (!CliMain.isConnected() || !hasKeySpace()) @@ -380,7 +380,7 @@ public class CliClient byte[] superColumnName = null; byte[] columnName = null; boolean isSuper = cfDef.column_type.equals("Super"); - + if ((columnSpecCnt < 0) || (columnSpecCnt > 2)) { sessionState.out.println("Invalid row, super column, or column specification."); @@ -445,7 +445,7 @@ public class CliClient private void doSlice(String keyspace, ByteBuffer key, String columnFamily, byte[] superColumnName, int limit) throws InvalidRequestException, UnavailableException, TimedOutException, TException, IllegalAccessException, NotFoundException, InstantiationException, NoSuchFieldException { - + long startTime = System.currentTimeMillis(); ColumnParent parent = new ColumnParent(columnFamily); if(superColumnName != null) @@ -475,7 +475,7 @@ public class CliClient validator.getString(col.value), col.timestamp, col.isSetTtl() ? String.format(", ttl=%d", col.getTtl()) : ""); } - + sessionState.out.println(")"); } else if (cosc.isSetColumn()) @@ -514,7 +514,7 @@ public class CliClient sessionState.out.printf("=> (counter=%s, value=%s)%n", formattedName, column.value); } } - + sessionState.out.println("Returned " + columns.size() + " results."); elapsedTime(startTime); } @@ -557,7 +557,7 @@ public class CliClient int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec); CfDef cfDef = getCfDef(columnFamily); boolean isSuper = cfDef.column_type.equals("Super"); - + byte[] superColumnName = null; ByteBuffer columnName; @@ -647,7 +647,7 @@ public class CliClient return; } - byte[] columnValue = column.getValue(); + byte[] columnValue = column.getValue(); String valueAsString; // we have ^(CONVERT_TO_TYPE ) inside of GET statement @@ -725,7 +725,7 @@ public class CliClient String columnFamily = CliCompiler.getColumnFamily(statement, keyspacesMap.get(keySpace).cf_defs); // ^(CONDITIONS ^(CONDITION $column $value) ...) Tree conditions = statement.getChild(1); - + // fetching column family definition CfDef columnFamilyDef = getCfDef(columnFamily); @@ -785,8 +785,8 @@ public class CliClient { throw new IllegalArgumentException("LIMIT should be greater than zero."); } - - clause.setCount(limitValue); + + clause.setCount(limitValue); } try @@ -812,7 +812,7 @@ public class CliClient { if (!CliMain.isConnected() || !hasKeySpace()) return; - + long startTime = System.currentTimeMillis(); // ^(NODE_COLUMN_ACCESS ) Tree columnFamilySpec = statement.getChild(0); @@ -869,7 +869,7 @@ public class CliClient parent.setSuper_column(superColumnName); Column columnToInsert = new Column(columnName).setValue(columnValueInBytes).setTimestamp(FBUtilities.timestampMicros()); - + // children count = 3 mean that we have ttl in arguments if (statement.getChildCount() == 3) { @@ -908,7 +908,7 @@ public class CliClient String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec, keyspacesMap.get(keySpace).cf_defs); ByteBuffer key = getKeyAsBytes(columnFamily, columnFamilySpec.getChild(1)); int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec); - + byte[] superColumnName = null; ByteBuffer columnName; @@ -967,7 +967,7 @@ public class CliClient { if (!CliMain.isConnected()) return; - + sessionState.out.println(thriftClient.describe_cluster_name()); } @@ -980,7 +980,7 @@ public class CliClient if (!CliMain.isConnected()) return; - + // first value is the keyspace name, after that it is all key=value String keyspaceName = statement.getChild(0).getText(); KsDef ksDef = new KsDef(keyspaceName, DEFAULT_PLACEMENT_STRATEGY, new LinkedList()); @@ -1108,9 +1108,9 @@ public class CliClient { KsDef ksDef = new KsDef(ksDefToUpdate); - // removing all column definitions - thrift system_update_keyspace method requires that + // removing all column definitions - thrift system_update_keyspace method requires that ksDef.setCf_defs(new LinkedList()); - + for(int i = 1; i < statement.getChildCount(); i += 2) { String currentStatement = statement.getChild(i).getText().toUpperCase(); @@ -1119,7 +1119,7 @@ public class CliClient switch(mArgument) { - case PLACEMENT_STRATEGY: + case PLACEMENT_STRATEGY: ksDef.setStrategy_class(CliUtils.unescapeSQLString(mValue)); break; case STRATEGY_OPTIONS: @@ -1152,7 +1152,7 @@ public class CliClient return ksDef; } - + /** * Update column family definition attributes * @param statement - ANTLR tree representing current statement @@ -1258,7 +1258,7 @@ public class CliClient * @throws TException - exception * @throws InvalidRequestException - exception * @throws NotFoundException - exception - * @throws SchemaDisagreementException + * @throws SchemaDisagreementException */ private void executeDelKeySpace(Tree statement) throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException @@ -1270,7 +1270,7 @@ public class CliClient String version = thriftClient.system_drop_keyspace(keyspaceName); sessionState.out.println(version); validateSchemaIsSettled(version); - + if (keyspaceName.equals(keySpace)) //we just deleted the keyspace we were authenticated too keySpace = null; } @@ -1281,9 +1281,9 @@ public class CliClient * @throws TException - exception * @throws InvalidRequestException - exception * @throws NotFoundException - exception - * @throws SchemaDisagreementException + * @throws SchemaDisagreementException */ - private void executeDelColumnFamily(Tree statement) + private void executeDelColumnFamily(Tree statement) throws TException, InvalidRequestException, NotFoundException, SchemaDisagreementException { if (!CliMain.isConnected() || !hasKeySpace()) @@ -1414,7 +1414,7 @@ public class CliClient if (!CliMain.isConnected() || !hasKeySpace()) return; - // getting CfDef, it will fail if there is no such column family in current keySpace. + // getting CfDef, it will fail if there is no such column family in current keySpace. CfDef cfDef = getCfDef(CliCompiler.getColumnFamily(columnFamily, keyspacesMap.get(keySpace).cf_defs)); thriftClient.truncate(cfDef.getName()); @@ -1513,7 +1513,7 @@ public class CliClient { if (!CliMain.isConnected()) return; - + sessionState.out.println(thriftClient.describe_version()); } @@ -1790,34 +1790,34 @@ public class CliClient * Returns true if this.keySpace is set, false otherwise * @return boolean */ - private boolean hasKeySpace() + private boolean hasKeySpace() { if (keySpace == null) { sessionState.out.println("Not authenticated to a working keyspace."); return false; } - + return true; } - - public String getKeySpace() + + public String getKeySpace() { return keySpace == null ? "unknown" : keySpace; } - - public void setKeySpace(String keySpace) throws NotFoundException, InvalidRequestException, TException + + public void setKeySpace(String keySpace) throws NotFoundException, InvalidRequestException, TException { this.keySpace = keySpace; // We do nothing with the return value, but it hits a cache and the tab-completer. getKSMetaData(keySpace); } - - public String getUsername() + + public String getUsername() { return username == null ? "default" : username; } - + public void setUsername(String username) { this.username = username; @@ -1840,14 +1840,14 @@ public class CliClient username = statement.getChild(1).getText(); password = statement.getChild(2).getText(); } - + if (keySpaceName == null) { sessionState.out.println("Keyspace argument required"); return; } - - try + + try { AuthenticationRequest authRequest; Map credentials = new HashMap(); @@ -1856,7 +1856,7 @@ public class CliClient thriftClient.set_keyspace(keySpaceName); - if (username != null && password != null) + if (username != null && password != null) { /* remove quotes */ password = password.replace("\'", ""); @@ -1865,19 +1865,19 @@ public class CliClient authRequest = new AuthenticationRequest(credentials); thriftClient.login(authRequest); } - + keySpace = keySpaceName; this.username = username != null ? username : "default"; - + CliMain.updateCompletor(CliUtils.getCfNamesByKeySpace(getKSMetaData(keySpace))); sessionState.out.println("Authenticated to keyspace: " + keySpace); - } - catch (AuthenticationException e) + } + catch (AuthenticationException e) { sessionState.err.println("Exception during authentication to the cassandra node: " + "verify keyspace exists, and you are using correct credentials."); - } - catch (AuthorizationException e) + } + catch (AuthorizationException e) { sessionState.err.println("You are not authorized to use keyspace: " + keySpaceName); } @@ -1888,8 +1888,8 @@ public class CliClient catch (NotFoundException e) { sessionState.err.println(keySpaceName + " does not exist."); - } - catch (TException e) + } + catch (TException e) { if (sessionState.debug) e.printStackTrace(sessionState.err); @@ -2145,12 +2145,12 @@ public class CliClient int portNumber = Integer.parseInt(statement.getChild(1).getText()); StringBuilder hostName = new StringBuilder(); - int idCount = idList.getChildCount(); + int idCount = idList.getChildCount(); for (int idx = 0; idx < idCount; idx++) { hostName.append(idList.getChild(idx).getText()); } - + // disconnect current connection, if any. // This is a no-op, if you aren't currently connected. CliMain.disconnect(); @@ -2172,13 +2172,13 @@ public class CliClient /** * To get Column Family Definition object from specified keyspace * @param keySpaceName key space name to search for specific column family - * @param columnFamilyName column family name + * @param columnFamilyName column family name * @return CfDef - Column family definition object */ private CfDef getCfDef(String keySpaceName, String columnFamilyName) { KsDef keySpaceDefinition = keyspacesMap.get(keySpaceName); - + for (CfDef columnFamilyDef : keySpaceDefinition.cf_defs) { if (columnFamilyDef.name.equals(columnFamilyName)) @@ -2213,24 +2213,24 @@ public class CliClient /** * Used to parse meta tree and compile meta attributes into List - * @param cfDef - column family definition + * @param cfDef - column family definition * @param meta (Tree representing Array of the hashes with metadata attributes) * @return List List of the ColumnDef's - * + * * meta is in following format - ^(ARRAY ^(HASH ^(PAIR .. ..) ^(PAIR .. ..)) ^(HASH ...)) */ private List getCFColumnMetaFromTree(CfDef cfDef, Tree meta) { // this list will be returned List columnDefinitions = new ArrayList(); - + // each child node is a ^(HASH ...) for (int i = 0; i < meta.getChildCount(); i++) { Tree metaHash = meta.getChild(i); ColumnDef columnDefinition = new ColumnDef(); - + // each child node is ^(PAIR $key $value) for (int j = 0; j < metaHash.getChildCount(); j++) { @@ -2262,11 +2262,11 @@ public class CliClient } else if (metaKey.equals("index_name")) { - columnDefinition.setIndex_name(metaVal); + columnDefinition.setIndex_name(metaVal); } } - // validating columnDef structure, 'name' and 'validation_class' must be set + // validating columnDef structure, 'name' and 'validation_class' must be set try { columnDefinition.validate(); @@ -2284,7 +2284,7 @@ public class CliClient /** * Getting IndexType object from indexType string - * @param indexTypeAsString - string return by parser corresponding to IndexType + * @param indexTypeAsString - string return by parser corresponding to IndexType * @return IndexType - an IndexType object */ private IndexType getIndexTypeFromString(String indexTypeAsString) @@ -2336,14 +2336,14 @@ public class CliClient throw new RuntimeException(e); } } - + /** * Converts column name into byte[] according to comparator type * @param column - column name from parser * @param columnFamily - column family name from parser * @return ByteBuffer - bytes into which column name was converted according to comparator type */ - private ByteBuffer columnNameAsBytes(String column, String columnFamily) + private ByteBuffer columnNameAsBytes(String column, String columnFamily) { CfDef columnFamilyDef = getCfDef(columnFamily); return columnNameAsBytes(column, columnFamilyDef); @@ -2354,7 +2354,7 @@ public class CliClient * @param columnFamilyDef - column family from parser * @return ByteBuffer bytes - into which column name was converted according to comparator type */ - private ByteBuffer columnNameAsBytes(String column, CfDef columnFamilyDef) + private ByteBuffer columnNameAsBytes(String column, CfDef columnFamilyDef) { String comparatorClass = columnFamilyDef.comparator_type; return getBytesAccordingToType(column, getFormatType(comparatorClass)); @@ -2400,7 +2400,7 @@ public class CliClient * @param columnFamilyDef - column family from parser * @return ByteBuffer bytes - into which column name was converted according to comparator type */ - private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef) + private ByteBuffer subColumnNameAsBytes(String superColumn, CfDef columnFamilyDef) { String comparatorClass = columnFamilyDef.subcomparator_type; @@ -2466,7 +2466,7 @@ public class CliClient private AbstractType getValidatorForValue(CfDef ColumnFamilyDef, byte[] columnNameInBytes) { String defaultValidator = ColumnFamilyDef.default_validation_class; - + for (ColumnDef columnDefinition : ColumnFamilyDef.getColumn_metadata()) { byte[] nameInBytes = columnDefinition.getName(); @@ -2477,7 +2477,7 @@ public class CliClient } } - if (defaultValidator != null && !defaultValidator.isEmpty()) + if (defaultValidator != null && !defaultValidator.isEmpty()) { return getFormatType(defaultValidator); } @@ -2516,7 +2516,7 @@ public class CliClient // current $value String val = CliUtils.unescapeSQLString(optionPair.getChild(1).getText()); - strategyOptions.put(key, val); + strategyOptions.put(key, val); } return strategyOptions; @@ -2526,15 +2526,15 @@ public class CliClient * Used to convert value (function argument, string) into byte[] * calls convertValueByFunction method with "withUpdate" set to false * @param functionCall - tree representing function call ^(FUNCTION_CALL function_name value) - * @param columnFamily - column family definition (CfDef) + * @param columnFamily - column family definition (CfDef) * @param columnName - also updates column family metadata for given column - * @return byte[] - string value as byte[] + * @return byte[] - string value as byte[] */ private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName) { return convertValueByFunction(functionCall, columnFamily, columnName, false); } - + /** * Used to convert value (function argument, string) into byte[] * @param functionCall - tree representing function call ^(FUNCTION_CALL function_name value) diff --git a/src/java/org/apache/cassandra/cli/CliCompiler.java b/src/java/org/apache/cassandra/cli/CliCompiler.java index d07e408555..5a0252dc5c 100644 --- a/src/java/org/apache/cassandra/cli/CliCompiler.java +++ b/src/java/org/apache/cassandra/cli/CliCompiler.java @@ -36,7 +36,7 @@ public class CliCompiler // of the ANTLRStringStream class. Note: This doesn't change the // token text-- but just relaxes the matching rules to match // in upper case. [Logic borrowed from Hive code.] - // + // // Also see discussion on this topic in: // http://www.antlr.org/wiki/pages/viewpage.action?pageId=1782. public static class ANTLRNoCaseStringStream extends ANTLRStringStream @@ -45,15 +45,15 @@ public class CliCompiler { super(input); } - + public int LA(int i) { int returnChar = super.LA(i); if (returnChar == CharStream.EOF) { - return returnChar; + return returnChar; } - else if (returnChar == 0) + else if (returnChar == 0) { return returnChar; } @@ -65,7 +65,7 @@ public class CliCompiler public static Tree compileQuery(String query) { Tree queryTree; - + try { ANTLRStringStream input = new ANTLRNoCaseStringStream(query); @@ -87,7 +87,7 @@ public class CliCompiler // if there was an exception we don't want to process request any further throw new RuntimeException(e.getMessage(), e); } - + return queryTree; } /* @@ -167,7 +167,7 @@ public class CliCompiler public static String getColumn(Tree astNode, int pos) { // Skip over table, column family and rowKey - return CliUtils.unescapeSQLString(astNode.getChild(pos + 2).getText()); + return CliUtils.unescapeSQLString(astNode.getChild(pos + 2).getText()); } - + } diff --git a/src/java/org/apache/cassandra/cli/CliCompleter.java b/src/java/org/apache/cassandra/cli/CliCompleter.java index 6f4e583a36..7384131f5a 100644 --- a/src/java/org/apache/cassandra/cli/CliCompleter.java +++ b/src/java/org/apache/cassandra/cli/CliCompleter.java @@ -38,7 +38,7 @@ public class CliCompleter extends SimpleCompletor "rename keyspace", "rename column family", "consistencylevel", - + "help connect", "help describe keyspace", "help exit", @@ -77,7 +77,7 @@ public class CliCompleter extends SimpleCompletor { super(commands); } - + String[] getKeyspaceCommands() { return keyspaceCommands; diff --git a/src/java/org/apache/cassandra/cli/CliMain.java b/src/java/org/apache/cassandra/cli/CliMain.java index 5d2e633c5b..2d900ba4ab 100644 --- a/src/java/org/apache/cassandra/cli/CliMain.java +++ b/src/java/org/apache/cassandra/cli/CliMain.java @@ -66,7 +66,7 @@ public class CliMain { transport = new TFramedTransport(socket); } - else + else { transport = socket; } @@ -88,7 +88,7 @@ public class CliMain thriftClient = cassandraClient; cliClient = new CliClient(sessionState, thriftClient); - + if ((sessionState.username != null) && (sessionState.password != null)) { // Authenticate @@ -121,7 +121,7 @@ public class CliMain return; } } - + if (sessionState.keyspace != null) { try @@ -192,7 +192,7 @@ public class CliMain } return true; } - + public static void updateCompletor(Set candidates) { Set actions = new HashSet(); @@ -201,9 +201,9 @@ public class CliMain for (String cmd : completer.getKeyspaceCommands()) actions.add(String.format("%s %s", cmd, cf)); } - + String[] strs = Arrays.copyOf(actions.toArray(), actions.toArray().length, String[].class); - + completer.setCandidateStrings(strs); } @@ -252,14 +252,14 @@ public class CliMain { try { - connect(sessionState.hostName, sessionState.thriftPort); + connect(sessionState.hostName, sessionState.thriftPort); } catch (RuntimeException e) { sessionState.err.println(e.getMessage()); } } - + if ( cliClient == null ) { // Connection parameter was either invalid or not present. @@ -287,12 +287,12 @@ public class CliMain } ConsoleReader reader = new ConsoleReader(); - + if (!sessionState.batch) { reader.addCompletor(completer); reader.setBellEnabled(false); - + String historyFile = System.getProperty("user.home") + File.separator + HISTORYFILE; try diff --git a/src/java/org/apache/cassandra/cli/CliSessionState.java b/src/java/org/apache/cassandra/cli/CliSessionState.java index 4156f227a6..9f956fdb1e 100644 --- a/src/java/org/apache/cassandra/cli/CliSessionState.java +++ b/src/java/org/apache/cassandra/cli/CliSessionState.java @@ -31,7 +31,7 @@ public class CliSessionState public String hostName; // cassandra server name public int thriftPort; // cassandra server's thrift port - public boolean framed = true; // cassandra server's framed transport + public boolean framed = true; // cassandra server's framed transport public boolean debug = false; // print stack traces when errors occur in the CLI public String username; // cassandra login name (if SimpleAuthenticator is used) public String password; // cassandra login password (if SimpleAuthenticator is used) @@ -57,7 +57,7 @@ public class CliSessionState public void setOut(PrintStream newOut) { - this.out = newOut; + this.out = newOut; } public void setErr(PrintStream newErr) diff --git a/src/java/org/apache/cassandra/cli/CliUtils.java b/src/java/org/apache/cassandra/cli/CliUtils.java index 4797f28e7b..a8e883b24d 100644 --- a/src/java/org/apache/cassandra/cli/CliUtils.java +++ b/src/java/org/apache/cassandra/cli/CliUtils.java @@ -9,7 +9,7 @@ import org.apache.cassandra.thrift.IndexOperator; import org.apache.cassandra.thrift.KsDef; import org.apache.commons.lang.StringEscapeUtils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -17,16 +17,16 @@ import org.apache.commons.lang.StringEscapeUtils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/client/RingCache.java b/src/java/org/apache/cassandra/client/RingCache.java index 9b28a83dd2..28c44ba509 100644 --- a/src/java/org/apache/cassandra/client/RingCache.java +++ b/src/java/org/apache/cassandra/client/RingCache.java @@ -62,12 +62,12 @@ public class RingCache public void refreshEndpointMap() { try { - + Cassandra.Client client = ConfigHelper.getClientFromOutputAddressList(conf); List ring = client.describe_ring(ConfigHelper.getOutputKeyspace(conf)); rangeMap = ArrayListMultimap.create(); - + for (TokenRange range : ring) { Token left = partitioner.getTokenFactory().fromString(range.start_token); diff --git a/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java b/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java index d08c9b371f..2858570be9 100644 --- a/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java +++ b/src/java/org/apache/cassandra/concurrent/CreationTimeAwareFuture.java @@ -32,27 +32,27 @@ import java.util.concurrent.TimeoutException; * * @param */ -public class CreationTimeAwareFuture implements Future +public class CreationTimeAwareFuture implements Future { private long creationTime = System.currentTimeMillis(); private Future future; - public CreationTimeAwareFuture(Future future) + public CreationTimeAwareFuture(Future future) { this.future = future; creationTime = System.currentTimeMillis(); } - public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException + public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { timeout = unit.toMillis(timeout); long overallTimeout = timeout - (System.currentTimeMillis() - creationTime); return future.get(overallTimeout, TimeUnit.MILLISECONDS); } - public boolean cancel(boolean mayInterruptIfRunning) + public boolean cancel(boolean mayInterruptIfRunning) { return future.cancel(mayInterruptIfRunning); } diff --git a/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java b/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java index fcbaf67104..fb8d9e025e 100644 --- a/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java +++ b/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java @@ -1,6 +1,6 @@ package org.apache.cassandra.concurrent; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.concurrent; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java b/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java index 29a457a77c..74b2ad979b 100644 --- a/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java +++ b/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java @@ -1,6 +1,6 @@ package org.apache.cassandra.concurrent; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.concurrent; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/concurrent/JMXConfigurableThreadPoolExecutor.java b/src/java/org/apache/cassandra/concurrent/JMXConfigurableThreadPoolExecutor.java index dbcd641146..65b3af911f 100644 --- a/src/java/org/apache/cassandra/concurrent/JMXConfigurableThreadPoolExecutor.java +++ b/src/java/org/apache/cassandra/concurrent/JMXConfigurableThreadPoolExecutor.java @@ -21,17 +21,17 @@ package org.apache.cassandra.concurrent; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; -public class JMXConfigurableThreadPoolExecutor extends JMXEnabledThreadPoolExecutor implements JMXConfigurableThreadPoolExecutorMBean +public class JMXConfigurableThreadPoolExecutor extends JMXEnabledThreadPoolExecutor implements JMXConfigurableThreadPoolExecutorMBean { public JMXConfigurableThreadPoolExecutor(int corePoolSize, long keepAliveTime, TimeUnit unit, - BlockingQueue workQueue, + BlockingQueue workQueue, NamedThreadFactory threadFactory, String jmxPath) { super(corePoolSize, keepAliveTime, unit, workQueue, threadFactory, jmxPath); } - + } \ No newline at end of file diff --git a/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java b/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java index 8fd7a319df..b3ee971fbd 100644 --- a/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java +++ b/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java @@ -29,7 +29,7 @@ import javax.management.ObjectName; /** * This is a wrapper class for the ScheduledThreadPoolExecutor. It provides an implementation - * for the afterExecute() found in the ThreadPoolExecutor class to log any unexpected + * for the afterExecute() found in the ThreadPoolExecutor class to log any unexpected * Runtime Exceptions. */ @@ -64,7 +64,7 @@ public class JMXEnabledThreadPoolExecutor extends DebuggableThreadPoolExecutor i { this(corePoolSize, corePoolSize, keepAliveTime, unit, workQueue, threadFactory, jmxPath); } - + public JMXEnabledThreadPoolExecutor(int corePoolSize, int maxPoolSize, long keepAliveTime, diff --git a/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java b/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java index a60a0d5412..37656018ad 100644 --- a/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java +++ b/src/java/org/apache/cassandra/concurrent/NamedThreadFactory.java @@ -22,8 +22,8 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; /** - * This class is an implementation of the ThreadFactory interface. This - * is useful to give Java threads meaningful names which is useful when using + * This class is an implementation of the ThreadFactory interface. This + * is useful to give Java threads meaningful names which is useful when using * a tool like JConsole. */ @@ -46,7 +46,7 @@ public class NamedThreadFactory implements ThreadFactory } public Thread newThread(Runnable runnable) - { + { String name = id + ":" + n.getAndIncrement(); Thread thread = new Thread(runnable, name); thread.setPriority(priority); diff --git a/src/java/org/apache/cassandra/concurrent/Stage.java b/src/java/org/apache/cassandra/concurrent/Stage.java index 9dc9eed6e5..48fe9add89 100644 --- a/src/java/org/apache/cassandra/concurrent/Stage.java +++ b/src/java/org/apache/cassandra/concurrent/Stage.java @@ -1,6 +1,6 @@ package org.apache.cassandra.concurrent; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.concurrent; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/concurrent/StageManager.java b/src/java/org/apache/cassandra/concurrent/StageManager.java index b96c1b3d25..c57b593dc5 100644 --- a/src/java/org/apache/cassandra/concurrent/StageManager.java +++ b/src/java/org/apache/cassandra/concurrent/StageManager.java @@ -40,7 +40,7 @@ public class StageManager static { stages.put(Stage.MUTATION, multiThreadedConfigurableStage(Stage.MUTATION, getConcurrentWriters())); - stages.put(Stage.READ, multiThreadedConfigurableStage(Stage.READ, getConcurrentReaders())); + stages.put(Stage.READ, multiThreadedConfigurableStage(Stage.READ, getConcurrentReaders())); stages.put(Stage.REQUEST_RESPONSE, multiThreadedStage(Stage.REQUEST_RESPONSE, Runtime.getRuntime().availableProcessors())); stages.put(Stage.INTERNAL_RESPONSE, multiThreadedStage(Stage.INTERNAL_RESPONSE, Runtime.getRuntime().availableProcessors())); stages.put(Stage.REPLICATE_ON_WRITE, multiThreadedConfigurableStage(Stage.REPLICATE_ON_WRITE, getConcurrentReplicators())); @@ -62,7 +62,7 @@ public class StageManager new NamedThreadFactory(stage.getJmxName()), stage.getJmxType()); } - + private static ThreadPoolExecutor multiThreadedConfigurableStage(Stage stage, int numThreads) { return new JMXConfigurableThreadPoolExecutor(numThreads, @@ -81,7 +81,7 @@ public class StageManager { return stages.get(stage); } - + /** * This method shuts down all registered stages. */ diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java index 1c2d1ec155..a7d1d14b6c 100644 --- a/src/java/org/apache/cassandra/config/CFMetaData.java +++ b/src/java/org/apache/cassandra/config/CFMetaData.java @@ -315,7 +315,7 @@ public final class CFMetaData .bloomFilterFpChance(oldCFMD.bloomFilterFpChance) .caching(oldCFMD.caching); } - + /** * generate a column family name for an index corresponding to the given column. * This is NOT the same as the index's name! This is only used in sstable filenames and is not exposed to users. @@ -437,7 +437,7 @@ public final class CFMetaData { return new ArrayList(array); } - + public String getComment() { return comment; @@ -457,7 +457,7 @@ public final class CFMetaData { return replicateOnWrite; } - + public int getGcGraceSeconds() { return gcGraceSeconds; @@ -611,7 +611,7 @@ public final class CFMetaData } /** applies implicit defaults to cf definition. useful in updates */ - public static void applyImplicitDefaults(org.apache.cassandra.thrift.CfDef cf_def) + public static void applyImplicitDefaults(org.apache.cassandra.thrift.CfDef cf_def) { if (!cf_def.isSetComment()) cf_def.setComment(""); @@ -781,7 +781,7 @@ public final class CFMetaData for (ByteBuffer name : column_metadata.keySet()) if (!newColumns.contains(name)) toRemove.add(name); - + // remove the ones leaving. for (ByteBuffer indexName : toRemove) { @@ -802,7 +802,7 @@ public final class CFMetaData for (ColumnDef def : toAdd) { AbstractType dValidClass = TypeParser.parse(def.validation_class); - ColumnDefinition cd = new ColumnDefinition(def.name, + ColumnDefinition cd = new ColumnDefinition(def.name, dValidClass, def.index_type == null ? null : IndexType.valueOf(def.index_type.name()), def.index_options, @@ -967,7 +967,7 @@ public final class CFMetaData try { AbstractType comparator = TypeParser.parse(cf_def.comparator_type); - + for (org.apache.cassandra.thrift.ColumnDef column : cf_def.column_metadata) { if (column.index_type != null && column.index_name == null) diff --git a/src/java/org/apache/cassandra/config/ColumnDefinition.java b/src/java/org/apache/cassandra/config/ColumnDefinition.java index 68875d6ec0..dbba2161d2 100644 --- a/src/java/org/apache/cassandra/config/ColumnDefinition.java +++ b/src/java/org/apache/cassandra/config/ColumnDefinition.java @@ -1,6 +1,6 @@ package org.apache.cassandra.config; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.config; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -45,13 +45,13 @@ public class ColumnDefinition private IndexType index_type; private Map index_options; private String index_name; - + public ColumnDefinition(ByteBuffer name, AbstractType validator, IndexType index_type, Map index_options, String index_name) { this.name = name; this.index_name = index_name; this.validator = validator; - + this.setIndexType(index_type, index_options); } @@ -282,7 +282,7 @@ public class ColumnDefinition { return index_name; } - + public void setIndexName(String s) { index_name = s; @@ -291,19 +291,19 @@ public class ColumnDefinition public void setIndexType(IndexType index_type, Map index_options) { this.index_type = index_type; - this.index_options = index_options; + this.index_options = index_options; } public IndexType getIndexType() { return index_type; } - + public Map getIndexOptions() { return index_options; } - + public AbstractType getValidator() { return validator; @@ -313,18 +313,18 @@ public class ColumnDefinition { this.validator = validator; } - + public static Map getStringMap(Map charMap) { if (charMap == null) return null; - + Map stringMap = new HashMap(); - - for (Map.Entry entry : charMap.entrySet()) + + for (Map.Entry entry : charMap.entrySet()) stringMap.put(entry.getKey().toString(), entry.getValue().toString()); - - + + return stringMap; } } diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index 69e0c40283..bc0f103feb 100644 --- a/src/java/org/apache/cassandra/config/Config.java +++ b/src/java/org/apache/cassandra/config/Config.java @@ -1,6 +1,6 @@ package org.apache.cassandra.config; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.config; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider; @@ -31,46 +31,46 @@ public class Config public String cluster_name = "Test Cluster"; public String authenticator; public String authority; - + /* Hashing strategy Random or OPHF */ public String partitioner; - + public Boolean auto_bootstrap = true; public Boolean hinted_handoff_enabled = true; public Integer max_hint_window_in_ms = Integer.MAX_VALUE; - + public SeedProviderDef seed_provider; public DiskAccessMode disk_access_mode = DiskAccessMode.auto; - + /* Address where to run the job tracker */ public String job_tracker_host; - + /* Job Jar Location */ public String job_jar_file_location; - + /* initial token in the ring */ public String initial_token; - + public Long rpc_timeout_in_ms = new Long(2000); public Integer streaming_socket_timeout_in_ms = new Integer(0); public Integer phi_convict_threshold = 8; - + public Integer concurrent_reads = 8; public Integer concurrent_writes = 32; public Integer concurrent_replicates = 32; - + public Integer memtable_flush_writers = null; // will get set to the length of data dirs in DatabaseDescriptor public Integer memtable_total_space_in_mb; public Integer sliced_buffer_size_in_kb = 64; - + public Integer storage_port = 7000; public Integer ssl_storage_port = 7001; public String listen_address; public String broadcast_address; - + public String rpc_address; public Integer rpc_port = 9160; public String rpc_server_type = "sync"; @@ -103,7 +103,7 @@ public class Config public CommitLogSync commitlog_sync; public Double commitlog_sync_batch_window_in_ms; public Integer commitlog_sync_period_in_ms; - + public String endpoint_snitch; public Boolean dynamic_snitch = true; public Integer dynamic_snitch_update_interval_in_ms = 100; @@ -163,14 +163,14 @@ public class Config periodic, batch } - + public static enum DiskAccessMode { auto, mmap, mmap_index_only, standard, } - + public static enum RequestSchedulerId { keyspace diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index 20a5466085..0c20160b86 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -71,7 +71,7 @@ public class DatabaseDescriptor private static IPartitioner partitioner; private static Config.DiskAccessMode indexAccessMode; - + private static Config conf; private static IAuthenticator authenticator = new AllowAllAuthenticator(); @@ -472,7 +472,7 @@ public class DatabaseDescriptor } /** load keyspace (table) definitions, but do not initialize the table instances. */ - public static void loadSchemas() throws IOException + public static void loadSchemas() throws IOException { ColumnFamilyStore schemaCFS = SystemTable.schemaCFS(SystemTable.SCHEMA_KEYSPACES_CF); @@ -556,8 +556,8 @@ public class DatabaseDescriptor { return conf.thrift_max_message_length_in_mb * 1024 * 1024; } - - public static int getThriftFramedTransportSize() + + public static int getThriftFramedTransportSize() { return conf.thrift_framed_transport_size_in_mb * 1024 * 1024; } @@ -603,7 +603,7 @@ public class DatabaseDescriptor { partitioner = newPartitioner; } - + public static IEndpointSnitch getEndpointSnitch() { return snitch; @@ -632,7 +632,7 @@ public class DatabaseDescriptor { return conf.job_tracker_host; } - + public static int getColumnIndexSize() { return conf.column_index_size_in_kb * 1024; @@ -762,7 +762,7 @@ public class DatabaseDescriptor { return conf.saved_caches_directory; } - + public static Set getSeeds() { return Collections.unmodifiableSet(new HashSet(seedProvider.getSeeds())); @@ -772,22 +772,22 @@ public class DatabaseDescriptor { return listenAddress; } - + public static InetAddress getBroadcastAddress() { return broadcastAddress; } - + public static void setBroadcastAddress(InetAddress broadcastAdd) { broadcastAddress = broadcastAdd; } - + public static InetAddress getRpcAddress() { return rpcAddress; } - + public static String getRpcServerType() { return conf.rpc_server_type; @@ -802,12 +802,12 @@ public class DatabaseDescriptor { return conf.rpc_min_threads; } - + public static Integer getRpcMaxThreads() { return conf.rpc_max_threads; } - + public static Integer getRpcSendBufferSize() { return conf.rpc_send_buff_size_in_bytes; diff --git a/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java b/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java index 1cf12b4618..804e42d8ec 100644 --- a/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java +++ b/src/java/org/apache/cassandra/config/RequestSchedulerOptions.java @@ -2,7 +2,7 @@ package org.apache.cassandra.config; import java.util.Map; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -10,16 +10,16 @@ import java.util.Map; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ /** diff --git a/src/java/org/apache/cassandra/config/SeedProviderDef.java b/src/java/org/apache/cassandra/config/SeedProviderDef.java index 4e33bfeb93..21c18d53c4 100644 --- a/src/java/org/apache/cassandra/config/SeedProviderDef.java +++ b/src/java/org/apache/cassandra/config/SeedProviderDef.java @@ -27,7 +27,7 @@ public class SeedProviderDef { public String class_name; public Map parameters; - + public SeedProviderDef(LinkedHashMap p) { class_name = (String)p.get("class_name"); diff --git a/src/java/org/apache/cassandra/cql/CQLStatement.java b/src/java/org/apache/cassandra/cql/CQLStatement.java index 803dd1d934..d884b6e1a1 100644 --- a/src/java/org/apache/cassandra/cql/CQLStatement.java +++ b/src/java/org/apache/cassandra/cql/CQLStatement.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -25,7 +25,7 @@ public class CQLStatement public StatementType type; public Object statement; public int boundTerms = 0; - + public CQLStatement(StatementType type, Object statement, int lastMarker) { this.type = type; diff --git a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java index 328a70b651..ad789c3e8c 100644 --- a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java +++ b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -49,7 +49,7 @@ public class CreateColumnFamilyStatement { this.name = name; } - + /** Perform validation of parsed params */ private void validate(List variables) throws InvalidRequestException { @@ -60,7 +60,7 @@ public class CreateColumnFamilyStatement throw new InvalidRequestException(String.format("\"%s\" is not a valid column family name", name)); if (name.length() > 32) throw new InvalidRequestException(String.format("Column family names shouldn't be more than 32 character long (got \"%s\")", name)); - + // Ensure that exactly one key has been specified. if (keyValidator.size() < 1) throw new InvalidRequestException("You must specify a PRIMARY KEY"); @@ -89,18 +89,18 @@ public class CreateColumnFamilyStatement } } - + /** Map a column name to a validator for its value */ public void addColumn(Term term, String comparator) { columns.put(term, comparator); } - + public void setKeyType(String validator) { keyValidator.add(validator); } - + public String getKeyType() { return keyValidator.get(0); @@ -124,12 +124,12 @@ public class CreateColumnFamilyStatement { return name; } - + // Column definitions private Map getColumns(AbstractType comparator) throws InvalidRequestException { Map columnDefs = new HashMap(); - + for (Map.Entry col : columns.entrySet()) { try @@ -148,14 +148,14 @@ public class CreateColumnFamilyStatement throw ex; } } - + return columnDefs; } /** * Returns a CFMetaData instance based on the parameters parsed from this * CREATE statement, or defaults where applicable. - * + * * @param keyspace keyspace to apply this column family to * @return a CFMetaData instance corresponding to the values parsed from this statement * @throws InvalidRequestException on failure to validate parsed parameters @@ -197,7 +197,7 @@ public class CreateColumnFamilyStatement } return newCFMD; } - + private String getPropertyString(String key, String defaultValue) { return cfProps.getPropertyString(key, defaultValue); diff --git a/src/java/org/apache/cassandra/cql/CreateIndexStatement.java b/src/java/org/apache/cassandra/cql/CreateIndexStatement.java index 42b62bcfb6..34940b5133 100644 --- a/src/java/org/apache/cassandra/cql/CreateIndexStatement.java +++ b/src/java/org/apache/cassandra/cql/CreateIndexStatement.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -26,26 +26,26 @@ public class CreateIndexStatement private final String columnFamily; private final String indexName; private final Term columnName; - + public CreateIndexStatement(String indexName, String columnFamily, Term columnName) { this.indexName = indexName; this.columnFamily = columnFamily; this.columnName = columnName; } - + /** Column family namespace. */ public String getColumnFamily() { return columnFamily; } - + /** Column name to index. */ public Term getColumnName() { return columnName; } - + /** Index name (or null). */ public String getIndexName() { diff --git a/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java b/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java index ca0b2282e9..0b8fea4c1e 100644 --- a/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java +++ b/src/java/org/apache/cassandra/cql/CreateKeyspaceStatement.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -34,16 +34,16 @@ import org.apache.cassandra.thrift.InvalidRequestException; /** A CREATE KEYSPACE statement parsed from a CQL query. */ public class CreateKeyspaceStatement -{ +{ private final String name; private final Map attrs; private String strategyClass; private Map strategyOptions = new HashMap(); - + /** * Creates a new CreateKeyspaceStatement instance for a given * keyspace name and keyword arguments. - * + * * @param name the name of the keyspace to create * @param attrs map of the raw keyword arguments that followed the WITH keyword. */ @@ -52,12 +52,12 @@ public class CreateKeyspaceStatement this.name = name; this.attrs = attrs; } - + /** * The CqlParser only goes as far as extracting the keyword arguments * from these statements, so this method is responsible for processing and * validating, and must be called prior to access. - * + * * @throws InvalidRequestException if arguments are missing or unacceptable */ public void validate() throws InvalidRequestException @@ -67,12 +67,12 @@ public class CreateKeyspaceStatement throw new InvalidRequestException(String.format("\"%s\" is not a valid keyspace name", name)); if (name.length() > 32) throw new InvalidRequestException(String.format("Keyspace names shouldn't be more than 32 character long (got \"%s\")", name)); - + // required if (!attrs.containsKey("strategy_class")) throw new InvalidRequestException("missing required argument \"strategy_class\""); strategyClass = attrs.get("strategy_class"); - + // optional for (String key : attrs.keySet()) if ((key.contains(":")) && (key.startsWith("strategy_options"))) diff --git a/src/java/org/apache/cassandra/cql/DeleteStatement.java b/src/java/org/apache/cassandra/cql/DeleteStatement.java index f19cd3b559..9de571ed2b 100644 --- a/src/java/org/apache/cassandra/cql/DeleteStatement.java +++ b/src/java/org/apache/cassandra/cql/DeleteStatement.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -45,7 +45,7 @@ public class DeleteStatement extends AbstractModification { private List columns; private List keys; - + public DeleteStatement(List columns, String keyspace, String columnFamily, String keyName, List keys, Attributes attrs) { super(keyspace, columnFamily, keyName, attrs); diff --git a/src/java/org/apache/cassandra/cql/QueryProcessor.java b/src/java/org/apache/cassandra/cql/QueryProcessor.java index befcb21246..78be1d35be 100644 --- a/src/java/org/apache/cassandra/cql/QueryProcessor.java +++ b/src/java/org/apache/cassandra/cql/QueryProcessor.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -170,7 +170,7 @@ public class QueryProcessor throw new InvalidRequestException("Start key must sort before (or equal to) finish key in your partitioner!"); } AbstractBounds bounds = new Bounds(startKey, finishKey); - + // XXX: Our use of Thrift structs internally makes me Sad. :( SlicePredicate thriftSlicePredicate = slicePredicateFromSelect(select, metadata, variables); validateSlicePredicate(metadata, thriftSlicePredicate); @@ -253,7 +253,7 @@ public class QueryProcessor rowMutations.addAll(update.prepareRowMutations(keyspace, clientState, variables)); } - + try { StorageProxy.mutate(rowMutations, consistency); @@ -267,12 +267,12 @@ public class QueryProcessor throw new TimedOutException(); } } - + private static SlicePredicate slicePredicateFromSelect(SelectStatement select, CFMetaData metadata, List variables) throws InvalidRequestException { SlicePredicate thriftSlicePredicate = new SlicePredicate(); - + if (select.isColumnRange() || select.getColumnNames().size() == 0) { SliceRange sliceRange = new SliceRange(); @@ -286,10 +286,10 @@ public class QueryProcessor { thriftSlicePredicate.column_names = getColumnNames(select, metadata, variables); } - + return thriftSlicePredicate; } - + /* Test for SELECT-specific taboos */ private static void validateSelect(String keyspace, SelectStatement select, List variables) throws InvalidRequestException { @@ -298,15 +298,15 @@ public class QueryProcessor // Finish key w/o start key (KEY < foo) if (!select.isKeyRange() && (select.getKeyFinish() != null)) throw new InvalidRequestException("Key range clauses must include a start key (i.e. KEY > term)"); - + // Key range and by-key(s) combined (KEY > foo AND KEY = bar) if (select.isKeyRange() && select.getKeys().size() > 0) throw new InvalidRequestException("You cannot combine key range and by-key clauses in a SELECT"); - + // Start and finish keys, *and* column relations (KEY > foo AND KEY < bar and name1 = value1). if (select.isKeyRange() && (select.getKeyFinish() != null) && (select.getColumnRelations().size() > 0)) throw new InvalidRequestException("You cannot combine key range and by-column clauses in a SELECT"); - + // Can't use more than one KEY = if (!select.isMultiKey() && select.getKeys().size() > 1) throw new InvalidRequestException("You cannot use more than one KEY = in a SELECT"); @@ -362,7 +362,7 @@ public class QueryProcessor validateSchemaIsSettled(); } - + public static void validateKey(ByteBuffer key) throws InvalidRequestException { if (key == null || key.remaining() == 0) @@ -405,7 +405,7 @@ public class QueryProcessor { validateColumnNames(Arrays.asList(column)); } - + public static void validateColumn(CFMetaData metadata, ByteBuffer name, ByteBuffer value) throws InvalidRequestException { @@ -424,7 +424,7 @@ public class QueryProcessor me.getMessage())); } } - + private static void validateSlicePredicate(CFMetaData metadata, SlicePredicate predicate) throws InvalidRequestException { @@ -433,13 +433,13 @@ public class QueryProcessor else validateColumnNames(predicate.column_names); } - + private static void validateSliceRange(CFMetaData metadata, SliceRange range) throws InvalidRequestException { validateSliceRange(metadata, range.start, range.finish, range.reversed); } - + private static void validateSliceRange(CFMetaData metadata, ByteBuffer start, ByteBuffer finish, boolean reversed) throws InvalidRequestException { @@ -448,7 +448,7 @@ public class QueryProcessor if (start.remaining() > 0 && finish.remaining() > 0 && orderedComparator.compare(start, finish) > 0) throw new InvalidRequestException("range finish must come after start in traversal order"); } - + // Copypasta from CassandraServer (where it is private). private static void validateSchemaAgreement() throws SchemaDisagreementException { @@ -467,13 +467,13 @@ public class QueryProcessor throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException { String keyspace = null; - + // Some statements won't have (or don't need) a keyspace (think USE, or CREATE). if (statement.type != StatementType.SELECT && StatementType.requiresKeyspace.contains(statement.type)) keyspace = clientState.getKeyspace(); CqlResult result = new CqlResult(); - + if (logger.isDebugEnabled()) logger.debug("CQL statement type: {}", statement.type.toString()); CFMetaData metadata; switch (statement.type) @@ -627,7 +627,7 @@ public class QueryProcessor batchUpdate(clientState, Collections.singletonList(update), update.getConsistencyLevel(), variables); result.type = CqlResultType.VOID; return result; - + case BATCH: BatchStatement batch = (BatchStatement) statement.statement; ThriftValidation.validateConsistencyLevel(keyspace, batch.getConsistencyLevel(), RequestType.WRITE); @@ -661,20 +661,20 @@ public class QueryProcessor result.type = CqlResultType.VOID; return result; - + case USE: clientState.setKeyspace(CliUtils.unescapeSQLString((String) statement.statement)); result.type = CqlResultType.VOID; - + return result; - + case TRUNCATE: Pair columnFamily = (Pair)statement.statement; keyspace = columnFamily.left == null ? clientState.getKeyspace() : columnFamily.left; validateColumnFamily(keyspace, columnFamily.right); clientState.hasColumnFamilyAccess(keyspace, columnFamily.right, Permission.WRITE); - + try { StorageProxy.truncateBlocking(keyspace, columnFamily.right); @@ -687,10 +687,10 @@ public class QueryProcessor { throw (UnavailableException) new UnavailableException().initCause(e); } - + result.type = CqlResultType.VOID; return result; - + case DELETE: DeleteStatement delete = (DeleteStatement)statement.statement; @@ -704,17 +704,17 @@ public class QueryProcessor { throw new TimedOutException(); } - + result.type = CqlResultType.VOID; return result; - + case CREATE_KEYSPACE: CreateKeyspaceStatement create = (CreateKeyspaceStatement)statement.statement; create.validate(); ThriftValidation.validateKeyspaceNotSystem(create.getName()); clientState.hasKeyspaceSchemaAccess(Permission.WRITE); validateSchemaAgreement(); - + try { KsDef ksd = new KsDef(create.getName(), @@ -731,10 +731,10 @@ public class QueryProcessor ex.initCause(e); throw ex; } - + result.type = CqlResultType.VOID; return result; - + case CREATE_COLUMNFAMILY: CreateColumnFamilyStatement createCf = (CreateColumnFamilyStatement)statement.statement; clientState.hasColumnFamilySchemaAccess(Permission.WRITE); @@ -752,10 +752,10 @@ public class QueryProcessor ex.initCause(e); throw ex; } - + result.type = CqlResultType.VOID; return result; - + case CREATE_INDEX: CreateIndexStatement createIdx = (CreateIndexStatement)statement.statement; clientState.hasColumnFamilySchemaAccess(Permission.WRITE); @@ -775,7 +775,7 @@ public class QueryProcessor { if (cd.index_type != null) throw new InvalidRequestException("Index already exists"); - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) logger.debug("Updating column {} definition for index {}", oldCfm.comparator.getString(columnName), createIdx.getIndexName()); cd.setIndex_type(IndexType.KEYS); cd.setIndex_name(createIdx.getIndexName()); @@ -798,7 +798,7 @@ public class QueryProcessor ex.initCause(e); throw ex; } - + result.type = CqlResultType.VOID; return result; @@ -832,7 +832,7 @@ public class QueryProcessor ThriftValidation.validateKeyspaceNotSystem(deleteKeyspace); clientState.hasKeyspaceSchemaAccess(Permission.WRITE); validateSchemaAgreement(); - + try { applyMigrationOnStage(new DropKeyspace(deleteKeyspace)); @@ -843,15 +843,15 @@ public class QueryProcessor ex.initCause(e); throw ex; } - + result.type = CqlResultType.VOID; return result; - + case DROP_COLUMNFAMILY: String deleteColumnFamily = (String)statement.statement; clientState.hasColumnFamilySchemaAccess(Permission.WRITE); validateSchemaAgreement(); - + try { applyMigrationOnStage(new DropColumnFamily(keyspace, deleteColumnFamily)); @@ -862,7 +862,7 @@ public class QueryProcessor ex.initCause(e); throw ex; } - + result.type = CqlResultType.VOID; return result; @@ -913,21 +913,21 @@ public class QueryProcessor return new CqlPreparedResult(statementId, statement.boundTerms); } - + public static CqlResult processPrepared(CQLStatement statement, ClientState clientState, List variables) throws UnavailableException, InvalidRequestException, TimedOutException, SchemaDisagreementException { - // Check to see if there are any bound variables to verify + // Check to see if there are any bound variables to verify if (!(variables.isEmpty() && (statement.boundTerms == 0))) { - if (variables.size() != statement.boundTerms) + if (variables.size() != statement.boundTerms) throw new InvalidRequestException(String.format("there were %d markers(?) in CQL but %d bound variables", statement.boundTerms, variables.size())); // at this point there is a match in count between markers and variables that is non-zero - if (logger.isTraceEnabled()) + if (logger.isTraceEnabled()) for (int i = 0; i < variables.size(); i++) logger.trace("[{}] '{}'", i+1, variables.get(i)); } @@ -970,15 +970,15 @@ public class QueryProcessor CqlLexer lexer = new CqlLexer(stream); TokenStream tokenStream = new CommonTokenStream(lexer); CqlParser parser = new CqlParser(tokenStream); - + // Parse the query string to a statement instance CQLStatement statement = parser.query(); - + // The lexer and parser queue up any errors they may have encountered // along the way, if necessary, we turn them into exceptions here. lexer.throwLastRecognitionError(); parser.throwLastRecognitionError(); - + return statement; } diff --git a/src/java/org/apache/cassandra/cql/Relation.java b/src/java/org/apache/cassandra/cql/Relation.java index eb34080aba..cf93151982 100644 --- a/src/java/org/apache/cassandra/cql/Relation.java +++ b/src/java/org/apache/cassandra/cql/Relation.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -30,10 +30,10 @@ public class Relation private Term entity; private RelationType relationType; private Term value; - + /** * Creates a new relation. - * + * * @param entity the kind of relation this is; what the term is being compared to. * @param type the type that describes how this entity relates to the value. * @param value the value being compared. @@ -44,22 +44,22 @@ public class Relation this.relationType = RelationType.forString(type); this.value = value; } - + public RelationType operator() { return relationType; } - + public Term getEntity() { return entity; } - + public Term getValue() { return value; } - + @Override public String toString() { @@ -70,7 +70,7 @@ public class Relation enum RelationType { EQ, LT, LTE, GTE, GT; - + public static RelationType forString(String s) { if (s.equals("=")) @@ -83,7 +83,7 @@ enum RelationType return GTE; else if (s.equals(">")) return GT; - + return null; } } diff --git a/src/java/org/apache/cassandra/cql/SelectExpression.java b/src/java/org/apache/cassandra/cql/SelectExpression.java index 6c223ef87a..67882cef4a 100644 --- a/src/java/org/apache/cassandra/cql/SelectExpression.java +++ b/src/java/org/apache/cassandra/cql/SelectExpression.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -28,23 +28,23 @@ import java.util.List; * determine which columns will appear in the result set. SelectExpression * instances encapsulate a parsed expression from a SELECT * statement. - * + * * See: doc/cql/CQL.html#SpecifyingColumns */ public class SelectExpression { public static final int MAX_COLUMNS_DEFAULT = 10000; - + private int numColumns = MAX_COLUMNS_DEFAULT; private boolean reverseColumns = false; private boolean hasFirstSet; private final boolean wildcard; private Term start, finish; private List columns; - + /** * Create a new SelectExpression for a range (slice) of columns. - * + * * @param start the starting column name * @param finish the finishing column name * @param count the number of columns to limit the results to @@ -61,10 +61,10 @@ public class SelectExpression this.wildcard = wildcard; hasFirstSet = firstSet; } - + /** * Create a new SelectExpression for a list of columns. - * + * * @param first the first (possibly only) column name to select on. * @param count the number of columns to limit the results on * @param reverse true to reverse column order @@ -79,10 +79,10 @@ public class SelectExpression reverseColumns = reverse; hasFirstSet = firstSet; } - + /** * Add an additional column name to a SelectExpression. - * + * * @param addTerm */ public void and(Term addTerm) @@ -90,12 +90,12 @@ public class SelectExpression assert !isColumnRange(); // Not possible when invoked by parser columns.add(addTerm); } - + public boolean isColumnRange() { return (start != null); } - + public boolean isColumnList() { return !isColumnRange(); @@ -109,12 +109,12 @@ public class SelectExpression { return reverseColumns; } - + public void setColumnsReversed(boolean reversed) { reverseColumns = reversed; } - + public void setColumnsLimit(int limit) { numColumns = limit; @@ -159,6 +159,6 @@ public class SelectExpression finish, columns); } - - + + } diff --git a/src/java/org/apache/cassandra/cql/SelectStatement.java b/src/java/org/apache/cassandra/cql/SelectStatement.java index eb87e53f08..23595f7290 100644 --- a/src/java/org/apache/cassandra/cql/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql/SelectStatement.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -43,7 +43,7 @@ public class SelectStatement private final ConsistencyLevel cLevel; private final WhereClause clause; private final int numRecords; - + public SelectStatement(SelectExpression expression, boolean isCountOper, String keyspace, String columnFamily, ConsistencyLevel cLevel, WhereClause clause, int numRecords) { @@ -55,32 +55,32 @@ public class SelectStatement this.clause = (clause != null) ? clause : new WhereClause(); this.numRecords = numRecords; } - + public boolean isKeyRange() { return clause.isKeyRange(); } - + public Set getKeys() { return clause.getKeys(); } - + public Term getKeyStart() { return clause.getStartKey(); } - + public Term getKeyFinish() { return clause.getFinishKey(); } - + public List getColumnRelations() { return clause.getColumnRelations(); } - + public boolean isColumnRange() { return expression.isColumnRange(); @@ -99,12 +99,12 @@ public class SelectStatement { return expression.getColumns(); } - + public Term getColumnStart() { return expression.getStart(); } - + public Term getColumnFinish() { return expression.getFinish(); @@ -124,12 +124,12 @@ public class SelectStatement { return columnFamily; } - + public boolean isColumnsReversed() { return expression.isColumnsReversed(); } - + public ConsistencyLevel getConsistencyLevel() { return cLevel; @@ -144,7 +144,7 @@ public class SelectStatement { return expression.getColumnsLimit(); } - + public boolean isCountOperation() { return isCountOper; @@ -179,7 +179,7 @@ public class SelectStatement { return Schema.instance.getComparator(keyspace, columnFamily); } - + public AbstractType getValueValidator(String keyspace, ByteBuffer column) { return Schema.instance.getValueValidator(keyspace, columnFamily, column); @@ -196,6 +196,6 @@ public class SelectStatement clause, numRecords); } - + } diff --git a/src/java/org/apache/cassandra/cql/StatementType.java b/src/java/org/apache/cassandra/cql/StatementType.java index 7988654653..09729aaefd 100644 --- a/src/java/org/apache/cassandra/cql/StatementType.java +++ b/src/java/org/apache/cassandra/cql/StatementType.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -26,7 +26,7 @@ public enum StatementType { SELECT, INSERT, UPDATE, BATCH, USE, TRUNCATE, DELETE, CREATE_KEYSPACE, CREATE_COLUMNFAMILY, CREATE_INDEX, DROP_INDEX, DROP_KEYSPACE, DROP_COLUMNFAMILY, ALTER_TABLE; - + // Statement types that don't require a keyspace to be set. private static final EnumSet topLevel = EnumSet.of(USE, CREATE_KEYSPACE, DROP_KEYSPACE); public static final EnumSet requiresKeyspace = EnumSet.complementOf(topLevel); diff --git a/src/java/org/apache/cassandra/cql/Term.java b/src/java/org/apache/cassandra/cql/Term.java index aef4659ddf..9223701865 100644 --- a/src/java/org/apache/cassandra/cql/Term.java +++ b/src/java/org/apache/cassandra/cql/Term.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -47,7 +47,7 @@ public class Term /** * Create new Term instance from a string, and an integer that corresponds * with the token ID from CQLParser. - * + * * @param text the text representation of the term. * @param type the term's type as an integer token ID. */ @@ -74,18 +74,18 @@ public class Term /** * Returns the text parsed to create this term. - * + * * @return the string term acquired from a CQL statement. */ public String getText() { return text; } - + /** * Returns the typed value, serialized to a ByteBuffer according to a * comparator/validator. - * + * * @return a ByteBuffer of the value. * @throws InvalidRequestException if unable to coerce the string to its type. */ @@ -94,11 +94,11 @@ public class Term try { if (!isBindMarker()) return validator.fromString(text); - + // must be a marker term so check for a CqlBindValue stored in the term if (bindIndex == null) throw new AssertionError("a marker Term was encountered with no index value"); - + return variables.get(bindIndex); } catch (MarshalException e) @@ -106,10 +106,10 @@ public class Term throw new InvalidRequestException(e.getMessage()); } } - + /** * Returns the typed value, serialized to a ByteBuffer. - * + * * @return a ByteBuffer of the value. * @throws InvalidRequestException if unable to coerce the string to its type. */ @@ -119,35 +119,35 @@ public class Term { case STRING: return AsciiType.instance.fromString(text); - case INTEGER: + case INTEGER: return IntegerType.instance.fromString(text); case UUID: // we specifically want the Lexical class here, not "UUIDType," because we're supposed to have // a uuid-shaped string here, and UUIDType also accepts integer or date strings (and turns them into version 1 uuids). return LexicalUUIDType.instance.fromString(text); - case FLOAT: + case FLOAT: return FloatType.instance.fromString(text); } - + // FIXME: handle scenario that should never happen return null; } /** * Obtain the term's type. - * + * * @return the type */ public TermType getType() { return type; } - + public String toString() { return String.format("Term(%s, type=%s)", getText(), type); } - + public boolean isBindMarker() { return type==TermType.QMARK; @@ -173,7 +173,7 @@ public class Term if (getClass() != obj.getClass()) return false; Term other = (Term) obj; - if (type==TermType.QMARK) return false; // markers are never equal + if (type==TermType.QMARK) return false; // markers are never equal if (text == null) { if (other.text != null) @@ -185,13 +185,13 @@ public class Term return true; } - + } enum TermType { STRING, INTEGER, UUID, FLOAT, QMARK; - + static TermType forInt(int type) { if ((type == CqlParser.STRING_LITERAL) || (type == CqlParser.IDENT)) @@ -204,7 +204,7 @@ enum TermType return FLOAT; else if (type == CqlParser.QMARK) return QMARK; - + // FIXME: handled scenario that should never occur. return null; } diff --git a/src/java/org/apache/cassandra/cql/UpdateStatement.java b/src/java/org/apache/cassandra/cql/UpdateStatement.java index 8f772a235e..d6d410a063 100644 --- a/src/java/org/apache/cassandra/cql/UpdateStatement.java +++ b/src/java/org/apache/cassandra/cql/UpdateStatement.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.cql; @@ -73,7 +73,7 @@ public class UpdateStatement extends AbstractModification this.columns = columns; this.keys = keys; } - + /** * Creates a new UpdateStatement from a column family name, a consistency level, * key, and lists of column names and values. It is intended for use with the @@ -105,17 +105,17 @@ public class UpdateStatement extends AbstractModification /** * Returns the consistency level of this UPDATE statement, either * one parsed from the CQL statement, or the default level otherwise. - * + * * @return the consistency level as a Thrift enum. */ public ConsistencyLevel getConsistencyLevel() { return (cLevel != null) ? cLevel : defaultConsistency; } - + /** * True if an explicit consistency level was parsed from the statement. - * + * * @return true if a consistency was parsed, false otherwise. */ public boolean isSetConsistencyLevel() @@ -244,29 +244,29 @@ public class UpdateStatement extends AbstractModification { return keys; } - + public Map getColumns() throws InvalidRequestException { // Created from an UPDATE if (columns != null) return columns; - + // Created from an INSERT - + // Don't hate, validate. if (columnNames.size() != columnValues.size()) throw new InvalidRequestException("unmatched column names/values"); if (columnNames.size() < 1) throw new InvalidRequestException("no columns specified for INSERT"); - + columns = new HashMap(); - + for (int i = 0; i < columnNames.size(); i++) columns.put(columnNames.get(i), new Operation(columnValues.get(i))); return columns; } - + public String toString() { return String.format("UpdateStatement(keyspace=%s, columnFamily=%s, keys=%s, columns=%s, consistency=%s, timestamp=%s, timeToLive=%s)", @@ -278,17 +278,17 @@ public class UpdateStatement extends AbstractModification timestamp, timeToLive); } - + public AbstractType getKeyType(String keyspace) { return Schema.instance.getCFMetaData(keyspace, columnFamily).getKeyValidator(); } - + public AbstractType getComparator(String keyspace) { return Schema.instance.getComparator(keyspace, columnFamily); } - + public AbstractType getValueValidator(String keyspace, ByteBuffer column) { return Schema.instance.getValueValidator(keyspace, columnFamily, column); @@ -303,5 +303,5 @@ public class UpdateStatement extends AbstractModification { return columnValues; } - + } diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java b/src/java/org/apache/cassandra/cql/WhereClause.java index 0007c98edb..349641a334 100644 --- a/src/java/org/apache/cassandra/cql/WhereClause.java +++ b/src/java/org/apache/cassandra/cql/WhereClause.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -50,20 +50,20 @@ public class WhereClause /** * Create a new WhereClause with the first parsed relation. - * + * * @param firstRelation key or column relation */ public WhereClause(Relation firstRelation) { and(firstRelation); } - + public WhereClause() {} - + /** * Add an additional relation to this WHERE clause. - * + * * @param relation the relation to add. */ public void and(Relation relation) @@ -84,22 +84,22 @@ public class WhereClause { return columns; } - + public boolean isKeyRange() { return startKey != null; } - + public Term getStartKey() { return startKey; } - + public Term getFinishKey() { return finishKey; } - + public Set getKeys() { return keys; diff --git a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java index 3e86e53592..aa596fd544 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java +++ b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java index 67567dd260..cd3a82fe31 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java +++ b/src/java/org/apache/cassandra/cql/jdbc/AbstractJdbcUUID.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -30,7 +30,7 @@ public abstract class AbstractJdbcUUID extends AbstractJdbcType { return obj.toString(); } - + public boolean isCaseSensitive() { return false; diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java index f4c4f176fc..85b258f337 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -32,9 +32,9 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcAscii extends AbstractJdbcType { public static final JdbcAscii instance = new JdbcAscii(); - + JdbcAscii() {} - + public boolean isCaseSensitive() { return true; @@ -96,7 +96,7 @@ public class JdbcAscii extends AbstractJdbcType { return getString(bytes); } - + public ByteBuffer decompose(String value) { return ByteBufferUtil.bytes(value, Charsets.US_ASCII); diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java index 99b5805380..1760502382 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcBoolean.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcBoolean extends AbstractJdbcType { public static final JdbcBoolean instance = new JdbcBoolean(); - + JdbcBoolean() {} - + public boolean isCaseSensitive() { return false; @@ -78,7 +78,7 @@ public class JdbcBoolean extends AbstractJdbcType throw new MarshalException("A boolean is stored in exactly 1 byte: "+bytes.remaining()); } byte value = bytes.get(bytes.position()); - + return value ==0 ? Boolean.FALSE.toString(): Boolean.TRUE.toString(); } @@ -97,7 +97,7 @@ public class JdbcBoolean extends AbstractJdbcType byte value = bytes.get(bytes.position()); return Boolean.valueOf(value ==0 ? false:true); } - + public ByteBuffer decompose(Boolean value) { return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java index cbb635585f..67e424e94e 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcBytes.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -30,7 +30,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcBytes extends AbstractJdbcType { public static final JdbcBytes instance = new JdbcBytes(); - + JdbcBytes() {} public boolean isCaseSensitive() @@ -87,7 +87,7 @@ public class JdbcBytes extends AbstractJdbcType { return bytes.duplicate(); } - + public ByteBuffer decompose(ByteBuffer value) { return value; diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java index da40e16314..2475294113 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcCounterColumn.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,22 +8,22 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ public class JdbcCounterColumn extends JdbcLong { public static final JdbcCounterColumn instance = new JdbcCounterColumn(); - + JdbcCounterColumn() {} } diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java index c612c28638..6d0e63fe3d 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcDate.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -50,11 +50,11 @@ public class JdbcDate extends AbstractJdbcType return new SimpleDateFormat(DEFAULT_FORMAT); } }; - + public static final JdbcDate instance = new JdbcDate(); - + JdbcDate() {} - + public boolean isCaseSensitive() { return false; @@ -100,7 +100,7 @@ public class JdbcDate extends AbstractJdbcType { throw new MarshalException("A date is exactly 8 bytes (stored as a long): " + bytes.remaining()); } - + // uses ISO-8601 formatted string return FORMATTER.get().format(new Date(bytes.getLong(bytes.position()))); } @@ -119,7 +119,7 @@ public class JdbcDate extends AbstractJdbcType { return new Date(ByteBufferUtil.toLong(bytes)); } - + public ByteBuffer decompose(Date value) { return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java index 37927952e7..5852b1a5d1 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcDecimal.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.math.BigDecimal; @@ -30,7 +30,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcDecimal extends AbstractJdbcType { public static final JdbcDecimal instance = new JdbcDecimal(); - + JdbcDecimal() {} public boolean isCaseSensitive() @@ -88,7 +88,7 @@ public class JdbcDecimal extends AbstractJdbcType public BigDecimal compose(ByteBuffer bytes) { if (bytes == null) return null; - + // do not consume the contents of the ByteBuffer bytes = bytes.duplicate(); int scale = bytes.getInt(); @@ -106,16 +106,16 @@ public class JdbcDecimal extends AbstractJdbcType public ByteBuffer decompose(BigDecimal value) { if (value == null) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + BigInteger bi = value.unscaledValue(); Integer scale = value.scale(); byte[] bibytes = bi.toByteArray(); byte[] sbytes = ByteBufferUtil.bytes(scale).array(); byte[] bytes = new byte[bi.toByteArray().length+4]; - + for (int i = 0 ; i < 4 ; i++) bytes[i] = sbytes[i]; for (int i = 4 ; i < bibytes.length+4 ; i++) bytes[i] = bibytes[i-4]; - + return ByteBuffer.wrap(bytes); } diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java index 6036608086..e19c34924e 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcDouble.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcDouble extends AbstractJdbcType { public static final JdbcDouble instance = new JdbcDouble(); - + JdbcDouble() {} - + public boolean isCaseSensitive() { return false; @@ -77,7 +77,7 @@ public class JdbcDouble extends AbstractJdbcType { throw new MarshalException("A double is exactly 8 bytes : "+bytes.remaining()); } - + return ((Double)ByteBufferUtil.toDouble(bytes)).toString(); } @@ -95,7 +95,7 @@ public class JdbcDouble extends AbstractJdbcType { return ByteBufferUtil.toDouble(bytes); } - + public ByteBuffer decompose(Double value) { return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value); diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java index 82d755bdbd..c9cc7ee698 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcFloat.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,9 +29,9 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcFloat extends AbstractJdbcType { public static final JdbcFloat instance = new JdbcFloat(); - + JdbcFloat() {} - + public boolean isCaseSensitive() { return false; @@ -77,7 +77,7 @@ public class JdbcFloat extends AbstractJdbcType { throw new MarshalException("A float is exactly 4 bytes : "+bytes.remaining()); } - + return ((Float)ByteBufferUtil.toFloat(bytes)).toString(); } @@ -95,7 +95,7 @@ public class JdbcFloat extends AbstractJdbcType { return ByteBufferUtil.toFloat(bytes); } - + public ByteBuffer decompose(Float value) { return (value==null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value); diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java index 5a05a803f5..908af05ac0 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcInt32.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcInteger.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcInteger.java index 358a1a4abb..0b9db8ec31 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcInteger.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcInteger.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -30,9 +30,9 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class JdbcInteger extends AbstractJdbcType { public static final JdbcInteger instance = new JdbcInteger(); - + JdbcInteger() {} - + public boolean isCaseSensitive() { return false; diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcLexicalUUID.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcLexicalUUID.java index 30fbdeeabd..5bbfb9a2fc 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcLexicalUUID.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcLexicalUUID.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,9 +29,9 @@ import org.apache.cassandra.utils.UUIDGen; public class JdbcLexicalUUID extends AbstractJdbcUUID { public static final JdbcLexicalUUID instance = new JdbcLexicalUUID(); - + public JdbcLexicalUUID() {} - + public String getString(ByteBuffer bytes) { if (bytes.remaining() == 0) diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcLong.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcLong.java index c54d8711e0..8c7869e86c 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcLong.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcLong.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcTimeUUID.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcTimeUUID.java index 314ab823e8..a86c22f95d 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcTimeUUID.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcTimeUUID.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,9 +29,9 @@ import org.apache.cassandra.utils.UUIDGen; public class JdbcTimeUUID extends AbstractJdbcUUID { public static final JdbcTimeUUID instance = new JdbcTimeUUID(); - + JdbcTimeUUID() {} - + public String getString(ByteBuffer bytes) { if (bytes.remaining() == 0) diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java index 1d8aba98ae..5b93273e7f 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -32,9 +32,9 @@ import com.google.common.base.Charsets; public class JdbcUTF8 extends AbstractJdbcType { public static final JdbcUTF8 instance = new JdbcUTF8(); - + public JdbcUTF8() {} - + public boolean isCaseSensitive() { return true; diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcUUID.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcUUID.java index 375c1f0c84..e8eb640190 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/JdbcUUID.java +++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcUUID.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,9 +29,9 @@ import org.apache.cassandra.utils.UUIDGen; public class JdbcUUID extends AbstractJdbcUUID { public static final JdbcUUID instance = new JdbcUUID(); - + JdbcUUID() {} - + public UUID compose(ByteBuffer bytes) { bytes = bytes.slice(); @@ -50,7 +50,7 @@ public class JdbcUUID extends AbstractJdbcUUID { throw new MarshalException("UUIDs must be exactly 16 bytes"); } - + return compose(bytes).toString(); } diff --git a/src/java/org/apache/cassandra/cql/jdbc/MarshalException.java b/src/java/org/apache/cassandra/cql/jdbc/MarshalException.java index 7d19c11e16..5bb6c3d71f 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/MarshalException.java +++ b/src/java/org/apache/cassandra/cql/jdbc/MarshalException.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/cql/jdbc/TypesMap.java b/src/java/org/apache/cassandra/cql/jdbc/TypesMap.java index 3d99c687b9..fb056bb5d6 100644 --- a/src/java/org/apache/cassandra/cql/jdbc/TypesMap.java +++ b/src/java/org/apache/cassandra/cql/jdbc/TypesMap.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -27,7 +27,7 @@ import java.util.Map; public class TypesMap { private final static Map> map = new HashMap>(); - + static { map.put("org.apache.cassandra.db.marshal.AsciiType", JdbcAscii.instance); @@ -46,7 +46,7 @@ public class TypesMap map.put("org.apache.cassandra.db.marshal.UTF8Type", JdbcUTF8.instance); map.put("org.apache.cassandra.db.marshal.UUIDType", JdbcUUID.instance); } - + public static AbstractJdbcType getTypeForComparator(String comparator) { // If not fully qualified, assume it's the short name for a built-in. diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateColumnFamilyStatement.java b/src/java/org/apache/cassandra/cql3/statements/CreateColumnFamilyStatement.java index dfd3a48c28..5f2891bcec 100644 --- a/src/java/org/apache/cassandra/cql3/statements/CreateColumnFamilyStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/CreateColumnFamilyStatement.java @@ -71,7 +71,7 @@ public class CreateColumnFamilyStatement extends SchemaAlteringStatement for (Map.Entry col : columns.entrySet()) { AbstractType validator = CFPropDefs.parseType(col.getValue()); - + columnDefs.put(col.getKey().key, new ColumnDefinition(col.getKey().key, validator, null, null, null)); } diff --git a/src/java/org/apache/cassandra/db/CollationController.java b/src/java/org/apache/cassandra/db/CollationController.java index c9589bc48b..036614c12e 100644 --- a/src/java/org/apache/cassandra/db/CollationController.java +++ b/src/java/org/apache/cassandra/db/CollationController.java @@ -151,7 +151,7 @@ public class CollationController }; ColumnFamily returnCF = container.cloneMeShallow(); filter.collateColumns(returnCF, Collections.singletonList(toCollate), gcBefore); - + // "hoist up" the requested data into a more recent sstable if (sstablesIterated > cfs.getMinimumCompactionThreshold() && !cfs.isCompactionDisabled() diff --git a/src/java/org/apache/cassandra/db/Column.java b/src/java/org/apache/cassandra/db/Column.java index 5b12a709ab..f72bcab7c9 100644 --- a/src/java/org/apache/cassandra/db/Column.java +++ b/src/java/org/apache/cassandra/db/Column.java @@ -243,7 +243,7 @@ public class Column implements IColumn { return localCopy(cfs, HeapAllocator.instance); } - + public IColumn localCopy(ColumnFamilyStore cfs, Allocator allocator) { return new Column(cfs.internOrCopy(name, allocator), allocator.clone(value), timestamp); diff --git a/src/java/org/apache/cassandra/db/ColumnFamily.java b/src/java/org/apache/cassandra/db/ColumnFamily.java index 35c289e141..9191df6456 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamily.java +++ b/src/java/org/apache/cassandra/db/ColumnFamily.java @@ -83,7 +83,7 @@ public class ColumnFamily extends AbstractColumnContainer assert cfm != null; this.cfm = cfm; } - + public ColumnFamily cloneMeShallow(ISortedColumns.Factory factory, boolean reversedInsertOrder) { ColumnFamily cf = ColumnFamily.create(cfm, factory, reversedInsertOrder); diff --git a/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java b/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java index dbe2379b57..d773efeb8f 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java +++ b/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java index 18b73baeb0..776b975c7d 100644 --- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java +++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java @@ -177,12 +177,12 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean metadata.compactionStrategyClass = CFMetaData.createCompactionStrategy(compactionStrategyClass); maybeReloadCompactionStrategy(); } - + public String getCompactionStrategyClass() { return metadata.compactionStrategyClass.getName(); } - + public Map getCompressionParameters() { return metadata.compressionParameters().asThriftOptions(); @@ -248,7 +248,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean { valid = false; unregisterMBean(); - + data.unreferenceSSTables(); indexManager.invalidate(); } @@ -411,7 +411,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean * @param ksName The keyspace name * @param cfName The columnFamily name */ - public static synchronized void loadNewSSTables(String ksName, String cfName) + public static synchronized void loadNewSSTables(String ksName, String cfName) { /** ks/cf existence checks will be done by open and getCFS methods for us */ Table table = Table.open(ksName); @@ -530,7 +530,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean for (String idxName : idxNames) indexes.add(cfs.indexManager.getColumnByIdxName(idxName)); - Collection sstables = cfs.getSSTables(); + Collection sstables = cfs.getSSTables(); try { cfs.indexManager.setIndexRemoved(indexes); @@ -651,11 +651,11 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean public void runMayThrow() throws InterruptedException, IOException { latch.await(); - + if (!icc.isEmpty()) { //only valid when memtables exist - + for (SecondaryIndex index : indexManager.getIndexesNotBackedByCfs()) { // flush any non-cfs backed indexes @@ -663,7 +663,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean index.forceBlockingFlush(); } } - + if (writeCommitLog) { // if we're not writing to the commit log, we are replaying the log, so marking @@ -1767,7 +1767,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean { return data.getCompressionRatio(); } - + /** true if this CFS contains secondary index data */ public boolean isIndex() { diff --git a/src/java/org/apache/cassandra/db/ColumnSerializer.java b/src/java/org/apache/cassandra/db/ColumnSerializer.java index 01aa9b186d..2d97d32f6e 100644 --- a/src/java/org/apache/cassandra/db/ColumnSerializer.java +++ b/src/java/org/apache/cassandra/db/ColumnSerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -37,7 +37,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; public class ColumnSerializer implements IColumnSerializer { private static final Logger logger = LoggerFactory.getLogger(ColumnSerializer.class); - + public final static int DELETION_MASK = 0x01; public final static int EXPIRATION_MASK = 0x02; public final static int COUNTER_MASK = 0x04; diff --git a/src/java/org/apache/cassandra/db/DeletedColumn.java b/src/java/org/apache/cassandra/db/DeletedColumn.java index c1986ae85e..adeff0c32d 100644 --- a/src/java/org/apache/cassandra/db/DeletedColumn.java +++ b/src/java/org/apache/cassandra/db/DeletedColumn.java @@ -27,7 +27,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; import org.apache.cassandra.utils.HeapAllocator; public class DeletedColumn extends Column -{ +{ public DeletedColumn(ByteBuffer name, int localDeletionTime, long timestamp) { this(name, ByteBufferUtil.bytes(localDeletionTime), timestamp); @@ -57,7 +57,7 @@ public class DeletedColumn extends Column return super.reconcile(column, allocator); return column.reconcile(this, allocator); } - + @Override public IColumn localCopy(ColumnFamilyStore cfs) { diff --git a/src/java/org/apache/cassandra/db/EchoedRow.java b/src/java/org/apache/cassandra/db/EchoedRow.java index 29e9006be1..ea518f658e 100644 --- a/src/java/org/apache/cassandra/db/EchoedRow.java +++ b/src/java/org/apache/cassandra/db/EchoedRow.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/ExpiringColumn.java b/src/java/org/apache/cassandra/db/ExpiringColumn.java index adf1913f20..2eb981dbe0 100644 --- a/src/java/org/apache/cassandra/db/ExpiringColumn.java +++ b/src/java/org/apache/cassandra/db/ExpiringColumn.java @@ -78,7 +78,7 @@ public class ExpiringColumn extends Column public int size() { /* - * An expired column adds to a Column : + * An expired column adds to a Column : * 4 bytes for the localExpirationTime * + 4 bytes for the timeToLive */ @@ -125,7 +125,7 @@ public class ExpiringColumn extends Column clonedName = allocator.clone(name); return new ExpiringColumn(clonedName, allocator.clone(value), timestamp, timeToLive, localExpirationTime); } - + @Override public String getString(AbstractType comparator) { diff --git a/src/java/org/apache/cassandra/db/IColumnContainer.java b/src/java/org/apache/cassandra/db/IColumnContainer.java index beb224a182..33753cfb38 100644 --- a/src/java/org/apache/cassandra/db/IColumnContainer.java +++ b/src/java/org/apache/cassandra/db/IColumnContainer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; diff --git a/src/java/org/apache/cassandra/db/IndexScanCommand.java b/src/java/org/apache/cassandra/db/IndexScanCommand.java index f9cec3c2ff..409f69a5c8 100644 --- a/src/java/org/apache/cassandra/db/IndexScanCommand.java +++ b/src/java/org/apache/cassandra/db/IndexScanCommand.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/db/Memtable.java b/src/java/org/apache/cassandra/db/Memtable.java index ddf21796d0..32d42feccf 100644 --- a/src/java/org/apache/cassandra/db/Memtable.java +++ b/src/java/org/apache/cassandra/db/Memtable.java @@ -317,7 +317,7 @@ public class Memtable /** * @param startWith Include data in the result from and including this key and to the end of the memtable - * @return An iterator of entries with the data from the start key + * @return An iterator of entries with the data from the start key */ public Iterator> getEntryIterator(final RowPosition startWith, final RowPosition stopAt) { diff --git a/src/java/org/apache/cassandra/db/MeteredFlusher.java b/src/java/org/apache/cassandra/db/MeteredFlusher.java index 3960cd7d7e..ca1fafac23 100644 --- a/src/java/org/apache/cassandra/db/MeteredFlusher.java +++ b/src/java/org/apache/cassandra/db/MeteredFlusher.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/RangeSliceCommand.java b/src/java/org/apache/cassandra/db/RangeSliceCommand.java index d7310b49af..59317eb3c5 100644 --- a/src/java/org/apache/cassandra/db/RangeSliceCommand.java +++ b/src/java/org/apache/cassandra/db/RangeSliceCommand.java @@ -64,7 +64,7 @@ import org.apache.thrift.TSerializer; public class RangeSliceCommand implements MessageProducer, IReadCommand { private static final RangeSliceCommandSerializer serializer = new RangeSliceCommandSerializer(); - + public final String keyspace; public final String column_family; diff --git a/src/java/org/apache/cassandra/db/ReadCommand.java b/src/java/org/apache/cassandra/db/ReadCommand.java index 721fcd40d3..f17fbdac07 100644 --- a/src/java/org/apache/cassandra/db/ReadCommand.java +++ b/src/java/org/apache/cassandra/db/ReadCommand.java @@ -57,7 +57,7 @@ public abstract class ReadCommand implements MessageProducer, IReadCommand public final QueryPath queryPath; public final String table; public final ByteBuffer key; - private boolean isDigestQuery = false; + private boolean isDigestQuery = false; protected final byte commandType; protected ReadCommand(String table, ByteBuffer key, QueryPath queryPath, byte cmdType) @@ -113,7 +113,7 @@ public abstract class ReadCommand implements MessageProducer, IReadCommand class ReadCommandSerializer implements IVersionedSerializer { private static final Map> CMD_SERIALIZER_MAP = new HashMap>(); - static + static { CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE_BY_NAMES, new SliceByNamesReadCommandSerializer()); CMD_SERIALIZER_MAP.put(ReadCommand.CMD_TYPE_GET_SLICE, new SliceFromReadCommandSerializer()); diff --git a/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java b/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java index f54d36d536..755c851dd6 100644 --- a/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java +++ b/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java @@ -28,12 +28,12 @@ import org.apache.cassandra.net.Message; import org.apache.cassandra.net.MessagingService; public class ReadRepairVerbHandler implements IVerbHandler -{ +{ public void doVerb(Message message, String id) - { + { byte[] body = message.getMessageBody(); FastByteArrayInputStream buffer = new FastByteArrayInputStream(body); - + try { RowMutation rm = RowMutation.serializer().deserialize(new DataInputStream(buffer), message.getVersion()); diff --git a/src/java/org/apache/cassandra/db/ReadResponse.java b/src/java/org/apache/cassandra/db/ReadResponse.java index 4b83785c65..75b59d3abf 100644 --- a/src/java/org/apache/cassandra/db/ReadResponse.java +++ b/src/java/org/apache/cassandra/db/ReadResponse.java @@ -27,7 +27,7 @@ import org.apache.cassandra.utils.ByteBufferUtil; /* - * The read response message is sent by the server when reading data + * The read response message is sent by the server when reading data * this encapsulates the tablename and the row that has been read. * The table name is needed so that we can use it to create repairs. */ @@ -44,7 +44,7 @@ private static IVersionedSerializer serializer_; { return serializer_; } - + private final Row row_; private final ByteBuffer digest_; @@ -62,12 +62,12 @@ private static IVersionedSerializer serializer_; digest_ = null; } - public Row row() + public Row row() { return row_; } - - public ByteBuffer digest() + + public ByteBuffer digest() { return digest_; } @@ -89,7 +89,7 @@ class ReadResponseSerializer implements IVersionedSerializer if (!response.isDigestQuery()) Row.serializer().serialize(response.row(), dos, version); } - + public ReadResponse deserialize(DataInput dis, int version) throws IOException { byte[] digest = null; diff --git a/src/java/org/apache/cassandra/db/RowIteratorFactory.java b/src/java/org/apache/cassandra/db/RowIteratorFactory.java index ccf1f6862b..c995c23252 100644 --- a/src/java/org/apache/cassandra/db/RowIteratorFactory.java +++ b/src/java/org/apache/cassandra/db/RowIteratorFactory.java @@ -41,7 +41,7 @@ public class RowIteratorFactory } }; - + /** * Get a row iterator over the provided memtables and sstables, between the provided keys * and filtered by the queryfilter. diff --git a/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java b/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java index 5934634c43..2be4f9f397 100644 --- a/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java +++ b/src/java/org/apache/cassandra/db/RowMutationVerbHandler.java @@ -60,8 +60,8 @@ public class RowMutationVerbHandler implements IVerbHandler { logger_.error("Error in row mutation", e); } - } - + } + /** * Older version (< 1.0) will not send this message at all, hence we don't * need to check the version of the data. @@ -70,7 +70,7 @@ public class RowMutationVerbHandler implements IVerbHandler { DataInputStream dis = new DataInputStream(new FastByteArrayInputStream(forwardBytes)); int size = dis.readInt(); - + // remove fwds from message to avoid infinite loop Message messageCopy = message.withHeaderRemoved(RowMutation.FORWARD_HEADER); for (int i = 0; i < size; i++) diff --git a/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java b/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java index a2fa22a1f3..976e040dde 100644 --- a/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java +++ b/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java @@ -30,7 +30,7 @@ import org.apache.cassandra.net.MessagingService; public class SchemaCheckVerbHandler implements IVerbHandler { private final Logger logger = LoggerFactory.getLogger(SchemaCheckVerbHandler.class); - + public void doVerb(Message message, String id) { logger.debug("Received schema check request."); diff --git a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java index bf3d16dc88..d7a14c3840 100644 --- a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java +++ b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java @@ -51,7 +51,7 @@ public class SliceByNamesReadCommand extends ReadCommand readCommand.setDigestQuery(isDigestQuery()); return readCommand; } - + public Row getRow(Table table) throws IOException { DecoratedKey dk = StorageService.getPartitioner().decorateKey(key); diff --git a/src/java/org/apache/cassandra/db/SnapshotCommand.java b/src/java/org/apache/cassandra/db/SnapshotCommand.java index dee0d8c3ad..21f8ba6ab2 100644 --- a/src/java/org/apache/cassandra/db/SnapshotCommand.java +++ b/src/java/org/apache/cassandra/db/SnapshotCommand.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java index f4c03a9330..6f2b9c8f92 100644 --- a/src/java/org/apache/cassandra/db/SystemTable.java +++ b/src/java/org/apache/cassandra/db/SystemTable.java @@ -74,7 +74,7 @@ public class SystemTable { return StorageService.getPartitioner().decorateKey(key); } - + public static void finishStartup() throws IOException { setupVersion(); @@ -273,13 +273,13 @@ public class SystemTable ex.initCause(err); throw ex; } - + SortedSet cols = new TreeSet(BytesType.instance); cols.add(CLUSTERNAME); QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF), cols); ColumnFamilyStore cfs = table.getColumnFamilyStore(STATUS_CF); ColumnFamily cf = cfs.getColumnFamily(filter); - + if (cf == null) { // this is a brand new node @@ -295,8 +295,8 @@ public class SystemTable return; } - - + + IColumn clusterCol = cf.getColumn(CLUSTERNAME); assert clusterCol != null; String savedClusterName = ByteBufferUtil.string(clusterCol.value()); @@ -352,7 +352,7 @@ public class SystemTable return generation; } - + public static boolean isBootstrapped() { Table table = Table.open(Table.SYSTEM_TABLE); @@ -369,7 +369,7 @@ public class SystemTable public static void setBootstrapped(boolean isBootstrapped) { ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF); - cf.addColumn(new Column(BOOTSTRAP, + cf.addColumn(new Column(BOOTSTRAP, ByteBuffer.wrap(new byte[] { (byte) (isBootstrapped ? 1 : 0) }), FBUtilities.timestampMicros())); RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, BOOTSTRAP_KEY); diff --git a/src/java/org/apache/cassandra/db/Table.java b/src/java/org/apache/cassandra/db/Table.java index a48a0abe5a..d39b6d13dd 100644 --- a/src/java/org/apache/cassandra/db/Table.java +++ b/src/java/org/apache/cassandra/db/Table.java @@ -74,9 +74,9 @@ public class Table // It is possible to call Table.open without a running daemon, so it makes sense to ensure // proper directories here as well as in CassandraDaemon. - static + static { - if (!StorageService.instance.isClientMode()) + if (!StorageService.instance.isClientMode()) { try { @@ -145,7 +145,7 @@ public class Table return t; } } - + public Collection getColumnFamilyStores() { return Collections.unmodifiableCollection(columnFamilyStores.values()); @@ -199,7 +199,7 @@ public class Table /** * Take a snapshot of the entire set of column families with a given timestamp - * + * * @param snapshotName the tag associated with the name of the snapshot. This value may not be null */ public void snapshot(String snapshotName) @@ -253,7 +253,7 @@ public class Table cfStore.clearSnapshot(snapshotName); } } - + /** * @return A list of open SSTableReaders */ @@ -295,7 +295,7 @@ public class Table { if (replicationStrategy != null) StorageService.instance.getTokenMetadata().unregister(replicationStrategy); - + replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name, ksm.strategyClass, StorageService.instance.getTokenMetadata(), @@ -310,10 +310,10 @@ public class Table ColumnFamilyStore cfs = columnFamilyStores.remove(cfId); if (cfs == null) return; - + unloadCf(cfs); } - + // disassociate a cfs from this table instance. private void unloadCf(ColumnFamilyStore cfs) throws IOException { @@ -331,7 +331,7 @@ public class Table } cfs.invalidate(); } - + /** adds a cf to internal structures, ends up creating disk files). */ public void initCf(Integer cfId, String cfName) { @@ -386,7 +386,7 @@ public class Table { if (writeCommitLog) CommitLog.instance.add(mutation); - + DecoratedKey key = StorageService.getPartitioner().decorateKey(mutation.key()); for (ColumnFamily cf : mutation.getColumnFamilies()) { diff --git a/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java b/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java index df46b280e5..0c3b8e9dd5 100644 --- a/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java +++ b/src/java/org/apache/cassandra/db/UnserializableColumnFamilyException.java @@ -24,7 +24,7 @@ import java.io.IOException; public class UnserializableColumnFamilyException extends IOException { public final int cfId; - + public UnserializableColumnFamilyException(String msg, int cfId) { super(msg); diff --git a/src/java/org/apache/cassandra/db/WriteResponse.java b/src/java/org/apache/cassandra/db/WriteResponse.java index e4634d10c5..bd900e6491 100644 --- a/src/java/org/apache/cassandra/db/WriteResponse.java +++ b/src/java/org/apache/cassandra/db/WriteResponse.java @@ -30,11 +30,11 @@ import org.apache.cassandra.utils.FBUtilities; /* - * This message is sent back the row mutation verb handler - * and basically specifies if the write succeeded or not for a particular + * This message is sent back the row mutation verb handler + * and basically specifies if the write succeeded or not for a particular * key in a table */ -public class WriteResponse +public class WriteResponse { private static WriteResponseSerializer serializer_ = new WriteResponseSerializer(); diff --git a/src/java/org/apache/cassandra/db/columniterator/IColumnIterator.java b/src/java/org/apache/cassandra/db/columniterator/IColumnIterator.java index 0e4c1aa32b..4aa752d82c 100644 --- a/src/java/org/apache/cassandra/db/columniterator/IColumnIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/IColumnIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/columniterator/ICountableColumnIterator.java b/src/java/org/apache/cassandra/db/columniterator/ICountableColumnIterator.java index 5ad7d03f8c..b69a4345d2 100644 --- a/src/java/org/apache/cassandra/db/columniterator/ICountableColumnIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/ICountableColumnIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/columniterator/IdentityQueryFilter.java b/src/java/org/apache/cassandra/db/columniterator/IdentityQueryFilter.java index ca60dc7550..06e910fa35 100644 --- a/src/java/org/apache/cassandra/db/columniterator/IdentityQueryFilter.java +++ b/src/java/org/apache/cassandra/db/columniterator/IdentityQueryFilter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/columniterator/IndexedSliceReader.java b/src/java/org/apache/cassandra/db/columniterator/IndexedSliceReader.java index 7902af6753..d2d9e9b3db 100644 --- a/src/java/org/apache/cassandra/db/columniterator/IndexedSliceReader.java +++ b/src/java/org/apache/cassandra/db/columniterator/IndexedSliceReader.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java b/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java index 7112092510..fdb0c5c085 100644 --- a/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/SSTableNamesIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.IOError; diff --git a/src/java/org/apache/cassandra/db/columniterator/SSTableSliceIterator.java b/src/java/org/apache/cassandra/db/columniterator/SSTableSliceIterator.java index 2e3575af5d..72fe1bf3ee 100644 --- a/src/java/org/apache/cassandra/db/columniterator/SSTableSliceIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/SSTableSliceIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/columniterator/SimpleAbstractColumnIterator.java b/src/java/org/apache/cassandra/db/columniterator/SimpleAbstractColumnIterator.java index 8a4cbf8d65..848a411150 100644 --- a/src/java/org/apache/cassandra/db/columniterator/SimpleAbstractColumnIterator.java +++ b/src/java/org/apache/cassandra/db/columniterator/SimpleAbstractColumnIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/columniterator/SimpleSliceReader.java b/src/java/org/apache/cassandra/db/columniterator/SimpleSliceReader.java index 4df4edbbf5..d2c19d240a 100644 --- a/src/java/org/apache/cassandra/db/columniterator/SimpleSliceReader.java +++ b/src/java/org/apache/cassandra/db/columniterator/SimpleSliceReader.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.columniterator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.columniterator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogExecutorService.java b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogExecutorService.java index 76806ca465..3a1af47f62 100644 --- a/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogExecutorService.java +++ b/src/java/org/apache/cassandra/db/commitlog/AbstractCommitLogExecutorService.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.commitlog; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.commitlog; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogExecutorService.java b/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogExecutorService.java index c4ff71a4c6..c1211382e6 100644 --- a/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogExecutorService.java +++ b/src/java/org/apache/cassandra/db/commitlog/BatchCommitLogExecutorService.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.commitlog; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.commitlog; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java index 18c2cb6e9c..ceb9291af7 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLog.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLog.java @@ -59,7 +59,7 @@ import javax.management.ObjectName; public class CommitLog implements CommitLogMBean { private static final int MAX_OUTSTANDING_REPLAY_COUNT = 1024; - + static final Logger logger = LoggerFactory.getLogger(CommitLog.class); public static final CommitLog instance = new CommitLog(); @@ -281,7 +281,7 @@ public class CommitLog implements CommitLogMBean i.incrementAndGet(); continue; } - + if (logger.isDebugEnabled()) logger.debug(String.format("replaying mutation for %s.%s: %s", rm.getTable(), @@ -339,7 +339,7 @@ public class CommitLog implements CommitLogMBean logger.info("Finished reading " + file); } } - + for (Map.Entry entry : invalidMutations.entrySet()) logger.info(String.format("Skipped %d mutations from unknown (probably removed) CF with id %d", entry.getValue().intValue(), entry.getKey())); @@ -453,11 +453,11 @@ public class CommitLog implements CommitLogMBean if (segment.contains(context)) break; } - + return null; } }; - + try { executor.submit(task).get(); @@ -508,7 +508,7 @@ public class CommitLog implements CommitLogMBean } /** - * Forces a new segment file to be allocated and activated. Used mainly by truncate. + * Forces a new segment file to be allocated and activated. Used mainly by truncate. */ public void forceNewSegment() throws ExecutionException, InterruptedException { @@ -530,7 +530,7 @@ public class CommitLog implements CommitLogMBean /** * Fetches a new segment file from the allocator and activates it. - * + * * @return the newly activated segment */ private void activateNextSegment() throws IOException diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java index c5e6fc055a..da30fe11a8 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java @@ -248,7 +248,7 @@ public class CommitLogAllocator * Adds a segment to our internal tracking list and makes it ready for consumption. * * @param segment the segment to add - * @return the newly added segment + * @return the newly added segment */ private CommitLogSegment internalAddReadySegment(CommitLogSegment segment) { @@ -335,7 +335,7 @@ public class CommitLogAllocator */ public void awaitTermination() throws InterruptedException { - allocationThread.join(); + allocationThread.join(); } /** diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java index d979a48f14..1ac1efd2a5 100644 --- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java +++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java @@ -6,16 +6,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.db.commitlog; @@ -125,7 +125,7 @@ public class CommitLogSegment catch (IOException e) { throw new IOError(e); - } + } } /** @@ -177,7 +177,7 @@ public class CommitLogSegment /** * Recycle processes an unneeded segment file for reuse. - * + * * @return a new CommitLogSegment representing the newly reusable segment. */ public CommitLogSegment recycle() @@ -235,7 +235,7 @@ public class CommitLogSegment /** * Appends a row mutation onto the commit log. Requres that hasCapacityFor has already been checked. * - * @param rowMutation the mutation to append to the commit log. + * @param rowMutation the mutation to append to the commit log. * @return the position of the appended mutation */ public ReplayPosition write(RowMutation rowMutation) throws IOException @@ -369,7 +369,7 @@ public class CommitLogSegment /** * Check to see if a certain ReplayPosition is contained by this segment file. * - * @param context the replay position to be checked + * @param context the replay position to be checked * @return true if the replay position is contained by this segment file. */ public boolean contains(ReplayPosition context) diff --git a/src/java/org/apache/cassandra/db/commitlog/ICommitLogExecutorService.java b/src/java/org/apache/cassandra/db/commitlog/ICommitLogExecutorService.java index 4784d8e5aa..647e4a714d 100644 --- a/src/java/org/apache/cassandra/db/commitlog/ICommitLogExecutorService.java +++ b/src/java/org/apache/cassandra/db/commitlog/ICommitLogExecutorService.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.commitlog; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.commitlog; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/commitlog/PeriodicCommitLogExecutorService.java b/src/java/org/apache/cassandra/db/commitlog/PeriodicCommitLogExecutorService.java index 5ba5085363..fb76f7b04f 100644 --- a/src/java/org/apache/cassandra/db/commitlog/PeriodicCommitLogExecutorService.java +++ b/src/java/org/apache/cassandra/db/commitlog/PeriodicCommitLogExecutorService.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.commitlog; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.commitlog; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java b/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java index 5567aa62ff..a258ee8a5d 100644 --- a/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java +++ b/src/java/org/apache/cassandra/db/commitlog/ReplayPosition.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.commitlog; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.commitlog; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactedRow.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactedRow.java index 1499e448be..40c4e97a5c 100644 --- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactedRow.java +++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactedRow.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java index 21a3a2c268..5e7b0888e9 100644 --- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java +++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionIterable.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionInterruptedException.java b/src/java/org/apache/cassandra/db/compaction/CompactionInterruptedException.java index a301a7d70d..74d152b514 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionInterruptedException.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionInterruptedException.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java b/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java index 5e0dfa71e7..270c3af68e 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionIterable.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java index f30510b3c5..94bc788b2b 100644 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@ -134,7 +134,7 @@ public class CompactionManager implements CompactionManagerMBean } submitBackground(cfs); } - finally + finally { compactionLock.readLock().unlock(); } @@ -180,7 +180,7 @@ public class CompactionManager implements CompactionManagerMBean } return this; } - finally + finally { // we probably already downgraded if (compactionLock.writeLock().isHeldByCurrentThread()) @@ -775,7 +775,7 @@ public class CompactionManager implements CompactionManagerMBean logger.info(String.format(format, writer.getFilename(), startsize, endsize, (int)(ratio*100), totalkeysWritten, dTime)); } - // flush to ensure we don't lose the tombstones on a restart, since they are not commitlog'd + // flush to ensure we don't lose the tombstones on a restart, since they are not commitlog'd cfs.indexManager.flushIndexesBlocking(); cfs.replaceCompactedSSTables(Arrays.asList(sstable), results); @@ -878,7 +878,7 @@ public class CompactionManager implements CompactionManagerMBean } } }; - + // don't submit to the executor if the compaction lock is held by the current thread. Instead return a simple // future that will be immediately immediately get()ed and executed. Happens during a migration, which locks // the compaction thread and then reinitializes a ColumnFamilyStore. Under normal circumstances, CFS spawns @@ -1083,16 +1083,16 @@ public class CompactionManager implements CompactionManagerMBean { return executor.getCompletedTaskCount() + validationExecutor.getCompletedTaskCount(); } - + private static class SimpleFuture implements Future { private Runnable runnable; - - private SimpleFuture(Runnable r) + + private SimpleFuture(Runnable r) { runnable = r; } - + public boolean cancel(boolean mayInterruptIfRunning) { throw new IllegalStateException("May not call SimpleFuture.cancel()"); diff --git a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java index c559e282d1..4e701bfbd7 100644 --- a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java +++ b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java index c1270db2c3..0ed5e593b7 100644 --- a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java +++ b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java index b0b605a9e2..5ee5eaa5f1 100644 --- a/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java +++ b/src/java/org/apache/cassandra/db/compaction/LeveledCompactionTask.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java index f7bc3ecdc3..a4cd5ce957 100644 --- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java +++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/OperationType.java b/src/java/org/apache/cassandra/db/compaction/OperationType.java index ecdc71c832..cf682efe8a 100644 --- a/src/java/org/apache/cassandra/db/compaction/OperationType.java +++ b/src/java/org/apache/cassandra/db/compaction/OperationType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java b/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java index 993ad06a72..8ea4639a90 100644 --- a/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java +++ b/src/java/org/apache/cassandra/db/compaction/PrecompactedRow.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.compaction; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.compaction; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/filter/AbstractColumnIterator.java b/src/java/org/apache/cassandra/db/filter/AbstractColumnIterator.java index d4760dcd4d..81a9ca54a0 100644 --- a/src/java/org/apache/cassandra/db/filter/AbstractColumnIterator.java +++ b/src/java/org/apache/cassandra/db/filter/AbstractColumnIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.filter; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.filter; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/filter/ExtendedFilter.java b/src/java/org/apache/cassandra/db/filter/ExtendedFilter.java index e7db31a413..df55c2507a 100644 --- a/src/java/org/apache/cassandra/db/filter/ExtendedFilter.java +++ b/src/java/org/apache/cassandra/db/filter/ExtendedFilter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.filter; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.filter; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java b/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java index 0b1ebc9c21..d6ab55294d 100644 --- a/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java +++ b/src/java/org/apache/cassandra/db/filter/NamesQueryFilter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.filter; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.filter; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -59,7 +59,7 @@ public class NamesQueryFilter implements IFilter { return new SSTableNamesIterator(sstable, key, columns); } - + public IColumnIterator getSSTableColumnIterator(SSTableReader sstable, FileDataInput file, DecoratedKey key) { return new SSTableNamesIterator(sstable, file, key, columns); diff --git a/src/java/org/apache/cassandra/db/filter/QueryFilter.java b/src/java/org/apache/cassandra/db/filter/QueryFilter.java index eb9813f538..b075f413c8 100644 --- a/src/java/org/apache/cassandra/db/filter/QueryFilter.java +++ b/src/java/org/apache/cassandra/db/filter/QueryFilter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.filter; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.filter; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/filter/QueryPath.java b/src/java/org/apache/cassandra/db/filter/QueryPath.java index a6d52e6081..858d5066fa 100644 --- a/src/java/org/apache/cassandra/db/filter/QueryPath.java +++ b/src/java/org/apache/cassandra/db/filter/QueryPath.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.filter; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.filter; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -93,8 +93,8 @@ public class QueryPath String cfName = din.readUTF(); ByteBuffer scName = ByteBufferUtil.readWithShortLength(din); ByteBuffer cName = ByteBufferUtil.readWithShortLength(din); - return new QueryPath(cfName.isEmpty() ? null : cfName, - scName.remaining() == 0 ? null : scName, + return new QueryPath(cfName.isEmpty() ? null : cfName, + scName.remaining() == 0 ? null : scName, cName.remaining() == 0 ? null : cName); } diff --git a/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java b/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java index 9dc68f0983..e6372c26d1 100644 --- a/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java +++ b/src/java/org/apache/cassandra/db/filter/SliceQueryFilter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.filter; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.filter; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -64,7 +64,7 @@ public class SliceQueryFilter implements IFilter { return new SSTableSliceIterator(sstable, key, start, finish, reversed); } - + public IColumnIterator getSSTableColumnIterator(SSTableReader sstable, FileDataInput file, DecoratedKey key) { return new SSTableSliceIterator(sstable, file, key, start, finish, reversed); @@ -126,9 +126,9 @@ public class SliceQueryFilter implements IFilter && ((!reversed && comparator.compare(column.name(), finish) > 0)) || (reversed && comparator.compare(column.name(), finish) < 0)) break; - + // only count live columns towards the `count` criteria - if (column.isLive() + if (column.isLive() && (!container.isMarkedForDelete() || column.mostRecentLiveChangeAt() > container.getMarkedForDeleteAt())) { diff --git a/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java b/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java index c137eada26..ba7360dc7f 100644 --- a/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java +++ b/src/java/org/apache/cassandra/db/index/PerColumnSecondaryIndex.java @@ -31,33 +31,33 @@ public abstract class PerColumnSecondaryIndex extends SecondaryIndex { /** * Delete a column from the index - * + * * @param valueKey the column value which is used as the index key * @param rowKey the underlying row key which is indexed * @param col all the column info */ public abstract void deleteColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException; - + /** * insert a column to the index - * + * * @param valueKey the column value which is used as the index key * @param rowKey the underlying row key which is indexed * @param col all the column info */ public abstract void insertColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException; - + /** * update a column from the index - * + * * @param valueKey the column value which is used as the index key * @param rowKey the underlying row key which is indexed * @param col all the column info */ public abstract void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) throws IOException; - + public String getNameForSystemTable(ByteBuffer column) { - return getIndexName(); + return getIndexName(); } } diff --git a/src/java/org/apache/cassandra/db/index/PerRowSecondaryIndex.java b/src/java/org/apache/cassandra/db/index/PerRowSecondaryIndex.java index f23980b538..df5a41ddce 100644 --- a/src/java/org/apache/cassandra/db/index/PerRowSecondaryIndex.java +++ b/src/java/org/apache/cassandra/db/index/PerRowSecondaryIndex.java @@ -36,35 +36,35 @@ public abstract class PerRowSecondaryIndex extends SecondaryIndex /** * Removes obsolete index entries and creates new ones for the given row key * and mutated columns. - * + * * @param rowKey the row key * @param cf the current rows data * @param mutatedIndexedColumns the set of columns that were changed or added * @param oldIndexedColumns the columns which were deleted - * @throws IOException + * @throws IOException */ public abstract void applyIndexUpdates(ByteBuffer rowKey, ColumnFamily cf, SortedSet mutatedIndexedColumns, ColumnFamily oldIndexedColumns) throws IOException; - - + + /** * cleans up deleted columns from cassandra cleanup compaction - * + * * @param key * @param indexedColumnsInRow */ public abstract void deleteFromIndex(DecoratedKey key, List indexedColumnsInRow); - - + + @Override public String getNameForSystemTable(ByteBuffer columnName) { try { return getIndexName()+ByteBufferUtil.string(columnName); - } + } catch (CharacterCodingException e) { throw new RuntimeException(e); diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java index 9571073278..64a696d67e 100644 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndex.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndex.java @@ -38,32 +38,32 @@ import org.slf4j.LoggerFactory; /** * Abstract base class for different types of secondary indexes. - * + * * Do not extend this directly, please pick from PerColumnSecondaryIndex or PerRowSecondaryIndex */ public abstract class SecondaryIndex { - + private static final Logger logger = LoggerFactory.getLogger(SecondaryIndex.class); - + public static final String CUSTOM_INDEX_OPTION_NAME = "class_name"; /** * Base CF that has many indexes */ protected ColumnFamilyStore baseCfs; - - + + /** * The column definitions which this index is responsible for */ protected Set columnDefs = Collections.newSetFromMap(new ConcurrentHashMap()); - + /** * Perform any initialization work */ public abstract void init(); - + /** * Validates the index_options passed in the ColumnDef * @throws ConfigurationException @@ -74,20 +74,20 @@ public abstract class SecondaryIndex * @return The name of the index */ abstract public String getIndexName(); - - + + /** * Return the unique name for this index and column * to be stored in the SystemTable that tracks if each column is built - * + * * @param columnName the name of the column * @return the unique name */ abstract public String getNameForSystemTable(ByteBuffer columnName); - + /** * Checks if the index for specified column is fully built - * + * * @param columnName the column * @return true if the index is fully built */ @@ -95,7 +95,7 @@ public abstract class SecondaryIndex { return SystemTable.isIndexBuilt(baseCfs.table.name, getNameForSystemTable(columnName)); } - + public void setIndexBuilt(ByteBuffer columnName) { SystemTable.setIndexBuilt(baseCfs.table.name, getNameForSystemTable(columnName)); @@ -105,7 +105,7 @@ public abstract class SecondaryIndex { SystemTable.setIndexRemoved(baseCfs.table.name, getNameForSystemTable(columnName)); } - + /** * Called at query time * Creates a implementation specific searcher instance for this index type @@ -113,7 +113,7 @@ public abstract class SecondaryIndex * @return the secondary index search impl */ protected abstract SecondaryIndexSearcher createSecondaryIndexSearcher(Set columns); - + /** * Forces this indexes in memory data to disk * @throws IOException @@ -124,14 +124,14 @@ public abstract class SecondaryIndex * Get current amount of memory this index is consuming (in bytes) */ public abstract long getLiveSize(); - + /** * Allow access to the underlying column family store if there is one * @return the underlying column family store or null */ public abstract ColumnFamilyStore getIndexCfs(); - - + + /** * Delete all files and references to this index * @param columnName the indexed column to remove @@ -149,7 +149,7 @@ public abstract class SecondaryIndex * @param truncatedAt The truncation timestamp, all data before that timestamp should be rejected. */ public abstract void truncate(long truncatedAt); - + /** * Builds the index using the data in the underlying CFS * Blocks till it's complete @@ -160,7 +160,7 @@ public abstract class SecondaryIndex getIndexName(), StringUtils.join(baseCfs.getSSTables(), ", "))); SortedSet columnNames = new TreeSet(); - + for (ColumnDefinition cdef : columnDefs) columnNames.add(cdef.name); @@ -173,7 +173,7 @@ public abstract class SecondaryIndex { future.get(); forceBlockingFlush(); - + // Mark all indexed columns as built if (this instanceof PerRowSecondaryIndex) { @@ -200,11 +200,11 @@ public abstract class SecondaryIndex logger.info("Index build of " + getIndexName() + " complete"); } - + /** * Builds the index using the data in the underlying CF, non blocking - * - * + * + * * @return A future object which the caller can block on (optional) */ public Future buildIndexAsync() @@ -219,10 +219,10 @@ public abstract class SecondaryIndex break; } } - + if (allAreBuilt) return null; - + // build it asynchronously; addIndex gets called by CFS open and schema update, neither of which // we want to block for a long period. (actual build is serialized on CompactionManager.) Runnable runnable = new Runnable() @@ -241,11 +241,11 @@ public abstract class SecondaryIndex { throw new AssertionError(e); } - + try { buildIndexBlocking(); - } + } catch (IOException e) { throw new RuntimeException(e); @@ -253,11 +253,11 @@ public abstract class SecondaryIndex } }; FutureTask f = new FutureTask(runnable, null); - + new Thread(f, "Creating index: " + getIndexName()).start(); return f; } - + public ColumnFamilyStore getBaseCfs() { return baseCfs; @@ -277,7 +277,7 @@ public abstract class SecondaryIndex { columnDefs.add(columnDef); } - + void removeColumnDef(ByteBuffer name) { Iterator it = columnDefs.iterator(); @@ -287,11 +287,11 @@ public abstract class SecondaryIndex it.remove(); } } - + /** * This is the primary way to create a secondary index instance for a CF column. * It will validate the index_options before initializing. - * + * * @param baseCfs the source of data for the Index * @param cdef the meta information about this column (index_type, index_options, name, etc...) * @@ -301,33 +301,33 @@ public abstract class SecondaryIndex public static SecondaryIndex createInstance(ColumnFamilyStore baseCfs, ColumnDefinition cdef) throws ConfigurationException { SecondaryIndex index; - + switch (cdef.getIndexType()) { - case KEYS: + case KEYS: index = new KeysIndex(); break; - case CUSTOM: + case CUSTOM: assert cdef.getIndexOptions() != null; String class_name = cdef.getIndexOptions().get(CUSTOM_INDEX_OPTION_NAME); assert class_name != null; try { index = (SecondaryIndex) Class.forName(class_name).newInstance(); - } + } catch (Exception e) { throw new RuntimeException(e); - } + } break; default: throw new RuntimeException("Unknown index type: " + cdef.getIndexName()); } - + index.addColumnDef(cdef); index.validateOptions(); index.setBaseCfs(baseCfs); - + return index; } } diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java index 10cd4525a9..037245ea2f 100644 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexBuilder.java @@ -37,7 +37,7 @@ public class SecondaryIndexBuilder extends CompactionInfo.Holder private final ColumnFamilyStore cfs; private final SortedSet columns; private final ReducingKeyIterator iter; - + public SecondaryIndexBuilder(ColumnFamilyStore cfs, SortedSet columns, ReducingKeyIterator iter) { this.cfs = cfs; diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java index aa16db2f0e..2d99d1c393 100644 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexManager.java @@ -49,16 +49,16 @@ public class SecondaryIndexManager * Organizes the indexes by column name */ private final ConcurrentNavigableMap indexesByColumn; - - + + /** * Keeps a single instance of a SecondaryIndex for many columns when the index type * has isRowLevelIndex() == true - * + * * This allows updates to happen to an entire row at once */ private final Map,SecondaryIndex> rowLevelIndexMap; - + /** * The underlying column family containing the source data for these indexes @@ -69,13 +69,13 @@ public class SecondaryIndexManager { indexesByColumn = new ConcurrentSkipListMap(); rowLevelIndexMap = new HashMap, SecondaryIndex>(); - + this.baseCfs = baseCfs; } /** * Drops and adds new indexes associated with the underlying CF - * @throws IOException + * @throws IOException */ public void reload() throws IOException { @@ -100,8 +100,8 @@ public class SecondaryIndexManager cfs.reload(); } } - - + + /** * Does a full, blocking rebuild of the indexes specified by columns from the sstables. * Does nothing if columns is empty. @@ -110,7 +110,7 @@ public class SecondaryIndexManager * * @param sstables the data to build from * @param columns the list of columns to index, ordered by comparator - * @throws IOException + * @throws IOException */ public void maybeBuildSecondaryIndexes(Collection sstables, SortedSet columns) throws IOException { @@ -170,15 +170,15 @@ public class SecondaryIndexManager /** * Removes a existing index * @param column the indexed column to remove - * @throws IOException + * @throws IOException */ public void removeIndexedColumn(ByteBuffer column) throws IOException { SecondaryIndex index = indexesByColumn.remove(column); - + if (index == null) return; - + // Remove this column from from row level index map if (index instanceof PerRowSecondaryIndex) { @@ -200,13 +200,13 @@ public class SecondaryIndexManager */ public synchronized Future addIndexedColumn(ColumnDefinition cdef) { - + if (indexesByColumn.containsKey(cdef.name)) return null; - + assert cdef.getIndexType() != null; logger.info("Creating new index : {}",cdef); - + SecondaryIndex index; try { @@ -214,14 +214,14 @@ public class SecondaryIndexManager } catch (ConfigurationException e) { throw new RuntimeException(e); - } - + } + // Keep a single instance of the index per-cf for row level indexes // since we want all columns to be under the index if (index instanceof PerRowSecondaryIndex) { SecondaryIndex currentIndex = rowLevelIndexMap.get(index.getClass()); - + if (currentIndex == null) { rowLevelIndexMap.put(index.getClass(), index); @@ -231,20 +231,20 @@ public class SecondaryIndexManager { index = currentIndex; index.addColumnDef(cdef); - } + } } else { index.init(); } - + // link in indexedColumns. this means that writes will add new data to // the index immediately, // so we don't have to lock everything while we do the build. it's up to // the operator to wait // until the index is actually built before using in queries. indexesByColumn.put(cdef.name, index); - + // if we're just linking in the index to indexedColumns on an // already-built index post-restart, we're done if (index.isIndexBuilt(cdef.name)) @@ -254,7 +254,7 @@ public class SecondaryIndexManager } /** - * + * * @param column the name of indexes column * @return the index */ @@ -282,7 +282,7 @@ public class SecondaryIndexManager for (Map.Entry entry : indexesByColumn.entrySet()) entry.getValue().forceBlockingFlush(); } - + /** * Returns the decoratedKey for a column value * @param name column name @@ -293,38 +293,38 @@ public class SecondaryIndexManager { return new DecoratedKey(new LocalToken(baseCfs.metadata.getColumnDefinition(name).getValidator(), value), value); } - - + + /** * @return all built indexes (ready to use) */ public List getBuiltIndexes() { List indexList = new ArrayList(); - + for (Map.Entry entry : indexesByColumn.entrySet()) { SecondaryIndex index = entry.getValue(); - - if (index.isIndexBuilt(entry.getKey())) + + if (index.isIndexBuilt(entry.getKey())) { indexList.add(entry.getValue().getIndexName()); } } - + return indexList; } - + public ByteBuffer getColumnByIdxName(String idxName) - { + { for (Map.Entry entry : indexesByColumn.entrySet()) { - if (entry.getValue().getIndexName().equals(idxName)) + if (entry.getValue().getIndexName().equals(idxName)) return entry.getKey(); } throw new RuntimeException("Unknown Index Name: " + idxName); } - + /** * @return all CFS from indexes which use a backing CFS internally (KEYS) */ @@ -335,14 +335,14 @@ public class SecondaryIndexManager for (Map.Entry entry : indexesByColumn.entrySet()) { ColumnFamilyStore cfs = entry.getValue().getIndexCfs(); - + if (cfs != null) - cfsList.add(cfs); + cfsList.add(cfs); } - + return cfsList; } - + /** * @return all indexes which do *not* use a backing CFS internally */ @@ -355,11 +355,11 @@ public class SecondaryIndexManager for (Map.Entry entry : indexesByColumn.entrySet()) { ColumnFamilyStore cfs = entry.getValue().getIndexCfs(); - + if (cfs == null) - indexList.put(entry.getValue(), null); + indexList.put(entry.getValue(), null); } - + return indexList.keySet(); } @@ -383,7 +383,7 @@ public class SecondaryIndexManager public long getTotalLiveSize() { long total = 0; - + // we use identity map because per row indexes use same instance // across many columns IdentityHashMap indexList = new IdentityHashMap(); @@ -391,65 +391,65 @@ public class SecondaryIndexManager for (Map.Entry entry : indexesByColumn.entrySet()) { SecondaryIndex index = entry.getValue(); - + if (indexList.put(index, index) == null) total += index.getLiveSize(); } - + return total; } - + /** * Removes obsolete index entries and creates new ones for the given row key * and mutated columns. - * + * * For columns whos underlying index type has the isRowLevelIndex() flag set to true this function will - * call the - * + * call the + * * @param rowKey the row key * @param cf the current rows data * @param mutatedIndexedColumns the set of columns that were changed or added * @param oldIndexedColumns the columns what were deleted - * @throws IOException + * @throws IOException */ public void applyIndexUpdates(ByteBuffer rowKey, ColumnFamily cf, SortedSet mutatedIndexedColumns, ColumnFamily oldIndexedColumns) throws IOException { - + // Identify the columns with PerRowSecondaryIndexes // we need to make sure this is only called once - Set> appliedRowLevelIndexes = null; - + Set> appliedRowLevelIndexes = null; + // remove the old index entries if (oldIndexedColumns != null) { for (ByteBuffer columnName : oldIndexedColumns.getColumnNames()) { - + IColumn column = oldIndexedColumns.getColumn(columnName); - + if (column == null) continue; - + //this was previously deleted so should not be in index if (column.isMarkedForDelete()) - continue; - + continue; + SecondaryIndex index = getIndexForColumn(columnName); if (index == null) { logger.debug("Looks like index got dropped mid-update. Skipping"); continue; } - + // Update entire row if we encounter a row level index if (index instanceof PerRowSecondaryIndex) { if (appliedRowLevelIndexes == null) appliedRowLevelIndexes = new HashSet>(); - + if (appliedRowLevelIndexes.add(index.getClass())) ((PerRowSecondaryIndex)index).applyIndexUpdates(rowKey, cf, mutatedIndexedColumns, oldIndexedColumns); } @@ -461,7 +461,7 @@ public class SecondaryIndexManager } } } - + //insert new columns for (ByteBuffer columnName : mutatedIndexedColumns) { @@ -481,19 +481,19 @@ public class SecondaryIndexManager { if (appliedRowLevelIndexes == null) appliedRowLevelIndexes = new HashSet>(); - + if (appliedRowLevelIndexes.add(index.getClass())) ((PerRowSecondaryIndex)index).applyIndexUpdates(rowKey, cf, mutatedIndexedColumns, oldIndexedColumns); } else { DecoratedKey valueKey = getIndexKeyFor(columnName, column.value()); - - ((PerColumnSecondaryIndex)index).insertColumn(valueKey, rowKey, column); + + ((PerColumnSecondaryIndex)index).insertColumn(valueKey, rowKey, column); } } } - + /** * Delete all columns from all indexes for this row * @param key the row key @@ -501,36 +501,36 @@ public class SecondaryIndexManager */ public void deleteFromIndexes(DecoratedKey key, List indexedColumnsInRow) throws IOException { - - // Identify the columns with isRowLevelIndex == true + + // Identify the columns with isRowLevelIndex == true // we need to make sure this is only called once - Set> cleanedRowLevelIndexes = null; - + Set> cleanedRowLevelIndexes = null; + for (IColumn column : indexedColumnsInRow) { SecondaryIndex index = indexesByColumn.get(column.name()); - + if (index == null) continue; - + //Update entire row if we encounter a row level index if (index instanceof PerRowSecondaryIndex) { if (cleanedRowLevelIndexes == null) cleanedRowLevelIndexes = new HashSet>(); - + if (cleanedRowLevelIndexes.add(index.getClass())) - ((PerRowSecondaryIndex)index).deleteFromIndex(key, indexedColumnsInRow); + ((PerRowSecondaryIndex)index).deleteFromIndex(key, indexedColumnsInRow); } else { DecoratedKey valueKey = getIndexKeyFor(column.name(), column.value()); ((PerColumnSecondaryIndex) index).deleteColumn(valueKey, key.key, column); } - } + } } - - + + /** * Get a list of IndexSearchers from the union of expression index types * @param clause the query clause @@ -539,42 +539,42 @@ public class SecondaryIndexManager private List getIndexSearchersForQuery(List clause) { List indexSearchers = new ArrayList(); - + Map> groupByIndexType = new HashMap>(); - - + + //Group columns by type for (IndexExpression ix : clause) { SecondaryIndex index = getIndexForColumn(ix.column_name); - + if (index == null) continue; - + Set columns = groupByIndexType.get(index.getClass().getCanonicalName()); - + if (columns == null) { columns = new HashSet(); groupByIndexType.put(index.getClass().getCanonicalName(), columns); } - - columns.add(ix.column_name); + + columns.add(ix.column_name); } - + //create searcher per type for (Map.Entry> entry : groupByIndexType.entrySet()) { indexSearchers.add( getIndexForColumn(entry.getValue().iterator().next()).createSecondaryIndexSearcher(entry.getValue()) ); } - + return indexSearchers; } - + /** * Performs a search across a number of column indexes * TODO: add support for querying across index types - * + * * @param clause the index query clause * @param range the row range to restrict to * @param dataFilter the column range to restrict to @@ -583,15 +583,15 @@ public class SecondaryIndexManager public List search(List clause, AbstractBounds range, int maxResults, IFilter dataFilter, boolean maxIsColumns) { List indexSearchers = getIndexSearchersForQuery(clause); - + if (indexSearchers.isEmpty()) return Collections.emptyList(); - + //We currently don't support searching across multiple index types if (indexSearchers.size() > 1) throw new RuntimeException("Unable to search across multiple secondary index types"); - - + + return indexSearchers.get(0).search(clause, range, maxResults, dataFilter, maxIsColumns); } @@ -600,7 +600,7 @@ public class SecondaryIndexManager for (ByteBuffer colName : indexes) indexesByColumn.get(colName).setIndexBuilt(colName); } - + public void setIndexRemoved(Collection indexes) { for (ByteBuffer colName : indexes) diff --git a/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java b/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java index a74b0dea42..cce1afe73b 100644 --- a/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java +++ b/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java @@ -32,7 +32,7 @@ public abstract class SecondaryIndexSearcher protected SecondaryIndexManager indexManager; protected Set columns; protected ColumnFamilyStore baseCfs; - + public SecondaryIndexSearcher(SecondaryIndexManager indexManager, Set columns) { this.indexManager = indexManager; diff --git a/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java b/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java index 7b22a48a08..fa663ca3a2 100644 --- a/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java +++ b/src/java/org/apache/cassandra/db/index/keys/KeysIndex.java @@ -47,10 +47,10 @@ public class KeysIndex extends PerColumnSecondaryIndex private static final Logger logger = LoggerFactory.getLogger(KeysIndex.class); private ColumnFamilyStore indexCfs; - public KeysIndex() + public KeysIndex() { } - + public void init() { assert baseCfs != null && columnDefs != null; @@ -75,7 +75,7 @@ public class KeysIndex extends PerColumnSecondaryIndex { if (column.isMarkedForDelete()) return; - + int localDeletionTime = (int) (System.currentTimeMillis() / 1000); ColumnFamily cfi = ColumnFamily.create(indexCfs.metadata); cfi.addTombstone(rowKey, localDeletionTime, column.timestamp()); @@ -98,30 +98,30 @@ public class KeysIndex extends PerColumnSecondaryIndex } if (logger.isDebugEnabled()) logger.debug("applying index row {} in {}", indexCfs.metadata.getKeyValidator().getString(valueKey.key), cfi); - + indexCfs.apply(valueKey, cfi); } - + public void updateColumn(DecoratedKey valueKey, ByteBuffer rowKey, IColumn col) - { - insertColumn(valueKey, rowKey, col); + { + insertColumn(valueKey, rowKey, col); } public void removeIndex(ByteBuffer columnName) throws IOException - { + { indexCfs.invalidate(); } public void forceBlockingFlush() throws IOException - { + { try { indexCfs.forceBlockingFlush(); - } + } catch (ExecutionException e) { throw new IOException(e); - } + } catch (InterruptedException e) { throw new IOException(e); diff --git a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java index 124169a2b8..bd4be7e8d1 100644 --- a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java +++ b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java @@ -37,12 +37,12 @@ import org.slf4j.LoggerFactory; public class KeysSearcher extends SecondaryIndexSearcher { private static final Logger logger = LoggerFactory.getLogger(KeysSearcher.class); - + public KeysSearcher(SecondaryIndexManager indexManager, Set columns) { super(indexManager, columns); } - + private IndexExpression highestSelectivityPredicate(List clause) { IndexExpression best = null; @@ -52,7 +52,7 @@ public class KeysSearcher extends SecondaryIndexSearcher //skip columns belonging to a different index type if(!columns.contains(expression.column_name)) continue; - + SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name); if (index == null || (expression.op != IndexOperator.EQ)) continue; diff --git a/src/java/org/apache/cassandra/db/marshal/AbstractCommutativeType.java b/src/java/org/apache/cassandra/db/marshal/AbstractCommutativeType.java index 8e4c304da1..358f4ebf2b 100644 --- a/src/java/org/apache/cassandra/db/marshal/AbstractCommutativeType.java +++ b/src/java/org/apache/cassandra/db/marshal/AbstractCommutativeType.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.db.marshal; diff --git a/src/java/org/apache/cassandra/db/marshal/AbstractType.java b/src/java/org/apache/cassandra/db/marshal/AbstractType.java index 750d883b7c..cab8d7f808 100644 --- a/src/java/org/apache/cassandra/db/marshal/AbstractType.java +++ b/src/java/org/apache/cassandra/db/marshal/AbstractType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -93,9 +93,9 @@ public abstract class AbstractType implements Comparator } }; } - + public abstract T compose(ByteBuffer bytes); - + public abstract ByteBuffer decompose(T value); /** get a string representation of the bytes suitable for log messages */ diff --git a/src/java/org/apache/cassandra/db/marshal/AsciiType.java b/src/java/org/apache/cassandra/db/marshal/AsciiType.java index 9522f09a63..341af1c4d3 100644 --- a/src/java/org/apache/cassandra/db/marshal/AsciiType.java +++ b/src/java/org/apache/cassandra/db/marshal/AsciiType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/marshal/BooleanType.java b/src/java/org/apache/cassandra/db/marshal/BooleanType.java index 00af80afb2..7621519e2b 100644 --- a/src/java/org/apache/cassandra/db/marshal/BooleanType.java +++ b/src/java/org/apache/cassandra/db/marshal/BooleanType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -39,7 +39,7 @@ public class BooleanType extends AbstractType { return JdbcBoolean.instance.decompose(value); } - + public int compare(ByteBuffer o1, ByteBuffer o2) { if ((o1 == null) || (o1.remaining() != 1)) @@ -64,15 +64,15 @@ public class BooleanType extends AbstractType public ByteBuffer fromString(String source) throws MarshalException { - + if (source.isEmpty()|| source.equalsIgnoreCase(Boolean.FALSE.toString())) return decompose(false); - + if (source.equalsIgnoreCase(Boolean.TRUE.toString())) return decompose(true); - + throw new MarshalException(String.format("unable to make boolean from '%s'", source)); - + } public void validate(ByteBuffer bytes) throws MarshalException diff --git a/src/java/org/apache/cassandra/db/marshal/BytesType.java b/src/java/org/apache/cassandra/db/marshal/BytesType.java index 3c7257fe68..1ac56c5218 100644 --- a/src/java/org/apache/cassandra/db/marshal/BytesType.java +++ b/src/java/org/apache/cassandra/db/marshal/BytesType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -42,7 +42,7 @@ public class BytesType extends AbstractType { return JdbcBytes.instance.decompose(value); } - + public int compare(ByteBuffer o1, ByteBuffer o2) { return BytesType.bytesCompare(o1, o2); @@ -54,7 +54,7 @@ public class BytesType extends AbstractType if(null == o2) return 0; else return -1; } - + return ByteBufferUtil.compareUnsigned(o1, o2); } diff --git a/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java b/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java index 6dbd2cbe98..713e608deb 100644 --- a/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java +++ b/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.db.marshal; diff --git a/src/java/org/apache/cassandra/db/marshal/DateType.java b/src/java/org/apache/cassandra/db/marshal/DateType.java index a8dbcef70c..999487629b 100644 --- a/src/java/org/apache/cassandra/db/marshal/DateType.java +++ b/src/java/org/apache/cassandra/db/marshal/DateType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import static org.apache.cassandra.cql.jdbc.JdbcDate.iso8601Patterns; @@ -35,7 +35,7 @@ public class DateType extends AbstractType public static final DateType instance = new DateType(); static final String DEFAULT_FORMAT = iso8601Patterns[3]; - + static final SimpleDateFormat FORMATTER = new SimpleDateFormat(DEFAULT_FORMAT); DateType() {} // singleton @@ -44,12 +44,12 @@ public class DateType extends AbstractType { return JdbcDate.instance.compose(bytes); } - + public ByteBuffer decompose(Date value) { return JdbcDate.instance.decompose(value); } - + public int compare(ByteBuffer o1, ByteBuffer o2) { if (o1.remaining() == 0) @@ -81,10 +81,10 @@ public class DateType extends AbstractType // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + long millis; ByteBuffer idBytes = null; - + if (source.toLowerCase().equals("now")) { millis = System.currentTimeMillis(); @@ -115,7 +115,7 @@ public class DateType extends AbstractType throw new MarshalException(String.format("unable to coerce '%s' to a formatted date (long)", source), e1); } } - + return idBytes; } diff --git a/src/java/org/apache/cassandra/db/marshal/DecimalType.java b/src/java/org/apache/cassandra/db/marshal/DecimalType.java index 1c44b97168..25ce95ec83 100644 --- a/src/java/org/apache/cassandra/db/marshal/DecimalType.java +++ b/src/java/org/apache/cassandra/db/marshal/DecimalType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.math.BigDecimal; @@ -30,7 +30,7 @@ public class DecimalType extends AbstractType { public static final DecimalType instance = new DecimalType(); - DecimalType() {} // singleton + DecimalType() {} // singleton public int compare(ByteBuffer bb0, ByteBuffer bb1) { @@ -42,7 +42,7 @@ public class DecimalType extends AbstractType { return 1; } - + return compose(bb0).compareTo(compose(bb1)); } @@ -69,7 +69,7 @@ public class DecimalType extends AbstractType { // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + BigDecimal decimal; try diff --git a/src/java/org/apache/cassandra/db/marshal/DoubleType.java b/src/java/org/apache/cassandra/db/marshal/DoubleType.java index 44d086b6ab..8a684de61a 100644 --- a/src/java/org/apache/cassandra/db/marshal/DoubleType.java +++ b/src/java/org/apache/cassandra/db/marshal/DoubleType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -29,17 +29,17 @@ public class DoubleType extends AbstractType { public static final DoubleType instance = new DoubleType(); - DoubleType() {} // singleton + DoubleType() {} // singleton public Double compose(ByteBuffer bytes) { return JdbcDouble.instance.compose(bytes); } - + public ByteBuffer decompose(Double value) { return JdbcDouble.instance.decompose(value); - } + } public int compare(ByteBuffer o1, ByteBuffer o2) { @@ -51,12 +51,12 @@ public class DoubleType extends AbstractType { return 1; } - + return compose(o1).compareTo(compose(o2)); } public String getString(ByteBuffer bytes) - { + { try { return JdbcDouble.instance.getString(bytes); @@ -72,7 +72,7 @@ public class DoubleType extends AbstractType // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + Double d; try { @@ -82,7 +82,7 @@ public class DoubleType extends AbstractType { throw new MarshalException(String.format("unable to coerce '%s' to a double", source), e1); } - + return decompose(d); } diff --git a/src/java/org/apache/cassandra/db/marshal/FloatType.java b/src/java/org/apache/cassandra/db/marshal/FloatType.java index b946407f19..6378a9d0e6 100644 --- a/src/java/org/apache/cassandra/db/marshal/FloatType.java +++ b/src/java/org/apache/cassandra/db/marshal/FloatType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -30,17 +30,17 @@ public class FloatType extends AbstractType { public static final FloatType instance = new FloatType(); - FloatType() {} // singleton + FloatType() {} // singleton public Float compose(ByteBuffer bytes) { return JdbcFloat.instance.compose(bytes); } - + public ByteBuffer decompose(Float value) { return JdbcFloat.instance.decompose(value); - } + } public int compare(ByteBuffer o1, ByteBuffer o2) { @@ -52,7 +52,7 @@ public class FloatType extends AbstractType { return 1; } - + return compose(o1).compareTo(compose(o2)); } @@ -73,7 +73,7 @@ public class FloatType extends AbstractType // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + try { float f = Float.parseFloat(source); @@ -82,7 +82,7 @@ public class FloatType extends AbstractType catch (NumberFormatException e1) { throw new MarshalException(String.format("unable to coerce '%s' to a float", source), e1); - } + } } public void validate(ByteBuffer bytes) throws MarshalException diff --git a/src/java/org/apache/cassandra/db/marshal/Int32Type.java b/src/java/org/apache/cassandra/db/marshal/Int32Type.java index c3774963eb..ff0abb28a6 100644 --- a/src/java/org/apache/cassandra/db/marshal/Int32Type.java +++ b/src/java/org/apache/cassandra/db/marshal/Int32Type.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -56,8 +56,8 @@ public class Int32Type extends AbstractType int diff = o1.get(o1.position()) - o2.get(o2.position()); if (diff != 0) return diff; - - + + return ByteBufferUtil.compareUnsigned(o1, o2); } diff --git a/src/java/org/apache/cassandra/db/marshal/IntegerType.java b/src/java/org/apache/cassandra/db/marshal/IntegerType.java index 9f303b2dca..f92de38fbd 100644 --- a/src/java/org/apache/cassandra/db/marshal/IntegerType.java +++ b/src/java/org/apache/cassandra/db/marshal/IntegerType.java @@ -135,7 +135,7 @@ public final class IntegerType extends AbstractType // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + BigInteger integerType; try diff --git a/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java b/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java index 664752ca5b..40486e41e9 100644 --- a/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java +++ b/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java b/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java index a19f48d3b9..3595a16d7b 100644 --- a/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java +++ b/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/db/marshal/LongType.java b/src/java/org/apache/cassandra/db/marshal/LongType.java index b604cac48a..4bf52340f2 100644 --- a/src/java/org/apache/cassandra/db/marshal/LongType.java +++ b/src/java/org/apache/cassandra/db/marshal/LongType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -56,8 +56,8 @@ public class LongType extends AbstractType int diff = o1.get(o1.position()) - o2.get(o2.position()); if (diff != 0) return diff; - - + + return ByteBufferUtil.compareUnsigned(o1, o2); } diff --git a/src/java/org/apache/cassandra/db/marshal/MarshalException.java b/src/java/org/apache/cassandra/db/marshal/MarshalException.java index 279f45d230..7774c33328 100644 --- a/src/java/org/apache/cassandra/db/marshal/MarshalException.java +++ b/src/java/org/apache/cassandra/db/marshal/MarshalException.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java index 81f226c32d..f2ed1f5b17 100644 --- a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java +++ b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -114,9 +114,9 @@ public class TimeUUIDType extends AbstractType // Return an empty ByteBuffer for an empty string. if (source.isEmpty()) return ByteBufferUtil.EMPTY_BYTE_BUFFER; - + ByteBuffer idBytes = null; - + // ffffffff-ffff-ffff-ffff-ffffffffff if (regexPattern.matcher(source).matches()) { @@ -130,7 +130,7 @@ public class TimeUUIDType extends AbstractType { throw new MarshalException(String.format("unable to make UUID from '%s'", source), e); } - + if (uuid.version() != 1) throw new MarshalException("TimeUUID supports only version 1 UUIDs"); } @@ -163,7 +163,7 @@ public class TimeUUIDType extends AbstractType throw new MarshalException(String.format("unable to coerce '%s' to version 1 UUID", source), e1); } } - + return idBytes; } diff --git a/src/java/org/apache/cassandra/db/marshal/UTF8Type.java b/src/java/org/apache/cassandra/db/marshal/UTF8Type.java index f4467e20fc..64ea92f430 100644 --- a/src/java/org/apache/cassandra/db/marshal/UTF8Type.java +++ b/src/java/org/apache/cassandra/db/marshal/UTF8Type.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -67,7 +67,7 @@ public class UTF8Type extends AbstractType if (!UTF8Validator.validate(bytes)) throw new MarshalException("String didn't validate."); } - + static class UTF8Validator { enum State { @@ -79,11 +79,11 @@ public class UTF8Type extends AbstractType THREE_80bf_2, FOUR_90bf, FOUR_80bf_3, - }; - + }; + // since we're not converting to java strings, we don't need to worry about converting to surrogates. // buf has already been sliced/duplicated. - static boolean validate(ByteBuffer buf) + static boolean validate(ByteBuffer buf) { buf = buf.slice(); int b = 0; @@ -118,7 +118,7 @@ public class UTF8Type extends AbstractType state = State.THREE_a0bf; else state = State.THREE_80bf_2; - break; + break; } else if ((b >> 3) == -2) { diff --git a/src/java/org/apache/cassandra/db/marshal/UUIDType.java b/src/java/org/apache/cassandra/db/marshal/UUIDType.java index e6ab16664d..69380d8965 100644 --- a/src/java/org/apache/cassandra/db/marshal/UUIDType.java +++ b/src/java/org/apache/cassandra/db/marshal/UUIDType.java @@ -1,7 +1,7 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -40,7 +40,7 @@ import static org.apache.cassandra.cql.jdbc.JdbcDate.iso8601Patterns; * - nil UUID is always lesser
* - compare timestamps if both are time-based
* - compare lexically, unsigned msb-to-lsb comparison
- * + * * @see "com.fasterxml.uuid.UUIDComparator" */ public class UUIDType extends AbstractType diff --git a/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java b/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java index 944ee9d0fc..d3fd777664 100644 --- a/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java +++ b/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java @@ -29,7 +29,7 @@ import org.apache.cassandra.db.RowMutation; public class AddColumnFamily extends Migration { private final CFMetaData cfm; - + public AddColumnFamily(CFMetaData cfm) throws ConfigurationException { super(System.nanoTime()); diff --git a/src/java/org/apache/cassandra/db/migration/AddKeyspace.java b/src/java/org/apache/cassandra/db/migration/AddKeyspace.java index d0f4bfdad3..432ebed981 100644 --- a/src/java/org/apache/cassandra/db/migration/AddKeyspace.java +++ b/src/java/org/apache/cassandra/db/migration/AddKeyspace.java @@ -30,7 +30,7 @@ import org.apache.cassandra.db.RowMutation; public class AddKeyspace extends Migration { private final KSMetaData ksm; - + public AddKeyspace(KSMetaData ksm) throws ConfigurationException { super(System.nanoTime()); diff --git a/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java b/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java index b83cf9d3cf..727674f922 100644 --- a/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java +++ b/src/java/org/apache/cassandra/db/migration/DropColumnFamily.java @@ -29,7 +29,7 @@ public class DropColumnFamily extends Migration { private final String ksName; private final String cfName; - + public DropColumnFamily(String ksName, String cfName) throws ConfigurationException { super(System.nanoTime()); diff --git a/src/java/org/apache/cassandra/db/migration/DropKeyspace.java b/src/java/org/apache/cassandra/db/migration/DropKeyspace.java index 0fd8cb9f44..18c7f5e91e 100644 --- a/src/java/org/apache/cassandra/db/migration/DropKeyspace.java +++ b/src/java/org/apache/cassandra/db/migration/DropKeyspace.java @@ -29,7 +29,7 @@ import org.apache.cassandra.db.RowMutation; public class DropKeyspace extends Migration { private final String name; - + public DropKeyspace(String name) throws ConfigurationException { super(System.nanoTime()); @@ -45,7 +45,7 @@ public class DropKeyspace extends Migration { return MigrationHelper.dropKeyspace(name, timestamp); } - + @Override public String toString() { diff --git a/src/java/org/apache/cassandra/db/migration/Migration.java b/src/java/org/apache/cassandra/db/migration/Migration.java index faf6784b6c..4aaad5b0e6 100644 --- a/src/java/org/apache/cassandra/db/migration/Migration.java +++ b/src/java/org/apache/cassandra/db/migration/Migration.java @@ -42,14 +42,14 @@ import org.apache.cassandra.utils.UUIDGen; * There are two parts to a migration (think of it as a schema update): * 1. data is written to the schema cf (SCHEMA_KEYSPACES_CF). * 2. updated models are applied to the cassandra instance. - * + * * Since all steps are not committed atomically, care should be taken to ensure that a node/cluster is reasonably * quiescent with regard to the Keyspace or ColumnFamily whose schema is being modified. */ public abstract class Migration { protected static final Logger logger = LoggerFactory.getLogger(Migration.class); - + public static final String NAME_VALIDATOR_REGEX = "\\w+"; public static final String MIGRATIONS_CF = "Migrations"; public static final String SCHEMA_CF = "Schema"; @@ -120,7 +120,7 @@ public abstract class Migration else return UUIDGen.getUUID(cf.getColumn(LAST_MIGRATION_KEY).value()); } - + public static boolean isLegalName(String s) { return s.matches(Migration.NAME_VALIDATOR_REGEX); diff --git a/src/java/org/apache/cassandra/dht/AbstractBounds.java b/src/java/org/apache/cassandra/dht/AbstractBounds.java index b85fc65818..da93292e87 100644 --- a/src/java/org/apache/cassandra/dht/AbstractBounds.java +++ b/src/java/org/apache/cassandra/dht/AbstractBounds.java @@ -1,6 +1,6 @@ package org.apache.cassandra.dht; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.dht; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java index 61082141a4..74ec226861 100644 --- a/src/java/org/apache/cassandra/dht/BootStrapper.java +++ b/src/java/org/apache/cassandra/dht/BootStrapper.java @@ -158,15 +158,15 @@ public class BootStrapper assert !maxEndpoint.equals(FBUtilities.getBroadcastAddress()); if (metadata.pendingRangeChanges(maxEndpoint) > 0) throw new RuntimeException("Every node is a bootstrap source! Please specify an initial token manually or wait for an existing bootstrap operation to finish."); - + return maxEndpoint; } static Token getBootstrapTokenFrom(InetAddress maxEndpoint) { Message message = new Message(FBUtilities.getBroadcastAddress(), - StorageService.Verb.BOOTSTRAP_TOKEN, - ArrayUtils.EMPTY_BYTE_ARRAY, + StorageService.Verb.BOOTSTRAP_TOKEN, + ArrayUtils.EMPTY_BYTE_ARRAY, Gossiper.instance.getVersion(maxEndpoint)); int retries = 5; long timeout = Math.max(MessagingService.getDefaultCallbackTimeout(), BOOTSTRAP_TIMEOUT); diff --git a/src/java/org/apache/cassandra/dht/Bounds.java b/src/java/org/apache/cassandra/dht/Bounds.java index b521178c77..9ff830ee23 100644 --- a/src/java/org/apache/cassandra/dht/Bounds.java +++ b/src/java/org/apache/cassandra/dht/Bounds.java @@ -1,6 +1,6 @@ package org.apache.cassandra.dht; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.dht; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/dht/BytesToken.java b/src/java/org/apache/cassandra/dht/BytesToken.java index 2026f12140..c3190b8f06 100644 --- a/src/java/org/apache/cassandra/dht/BytesToken.java +++ b/src/java/org/apache/cassandra/dht/BytesToken.java @@ -46,10 +46,10 @@ public class BytesToken extends Token } public int compareTo(Token o) - { + { return FBUtilities.compareUnsigned(token, o.token, 0, 0, token.length, o.token.length); } - + @Override public int hashCode() @@ -66,7 +66,7 @@ public class BytesToken extends Token if (!(obj instanceof BytesToken)) return false; BytesToken other = (BytesToken) obj; - + return Arrays.equals(token, other.token); } } diff --git a/src/java/org/apache/cassandra/dht/IPartitioner.java b/src/java/org/apache/cassandra/dht/IPartitioner.java index aaa75fa0d0..0b8c28c7db 100644 --- a/src/java/org/apache/cassandra/dht/IPartitioner.java +++ b/src/java/org/apache/cassandra/dht/IPartitioner.java @@ -30,11 +30,11 @@ public interface IPartitioner * @deprecated Used by SSTables before version 'e'. * * Convert the on disk representation to a DecoratedKey object - * @param key On disk representation + * @param key On disk representation * @return DecoratedKey object */ public DecoratedKey convertFromDiskFormat(ByteBuffer key); - + /** * Transform key to object representation of the on-disk format. * @@ -69,7 +69,7 @@ public interface IPartitioner public T getRandomToken(); public Token.TokenFactory getTokenFactory(); - + /** * @return True if the implementing class preserves key order in the Tokens * it generates. diff --git a/src/java/org/apache/cassandra/dht/LocalPartitioner.java b/src/java/org/apache/cassandra/dht/LocalPartitioner.java index 8c4be42807..b5b98121e5 100644 --- a/src/java/org/apache/cassandra/dht/LocalPartitioner.java +++ b/src/java/org/apache/cassandra/dht/LocalPartitioner.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java b/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java index 6c781f03cb..fb69e3dc1d 100644 --- a/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java +++ b/src/java/org/apache/cassandra/dht/OrderPreservingPartitioner.java @@ -41,7 +41,7 @@ public class OrderPreservingPartitioner extends AbstractPartitioner { return new DecoratedKey(getToken(key), key); } - + public DecoratedKey convertFromDiskFormat(ByteBuffer key) { return new DecoratedKey(getToken(key), key); diff --git a/src/java/org/apache/cassandra/dht/RandomPartitioner.java b/src/java/org/apache/cassandra/dht/RandomPartitioner.java index c4c9091f34..15364d3512 100644 --- a/src/java/org/apache/cassandra/dht/RandomPartitioner.java +++ b/src/java/org/apache/cassandra/dht/RandomPartitioner.java @@ -46,7 +46,7 @@ public class RandomPartitioner extends AbstractPartitioner { return new DecoratedKey(getToken(key), key); } - + public DecoratedKey convertFromDiskFormat(ByteBuffer fromdisk) { // find the delimiter position diff --git a/src/java/org/apache/cassandra/gms/ApplicationState.java b/src/java/org/apache/cassandra/gms/ApplicationState.java index 9209c3c7b2..e966c969c4 100644 --- a/src/java/org/apache/cassandra/gms/ApplicationState.java +++ b/src/java/org/apache/cassandra/gms/ApplicationState.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/gms/EndpointState.java b/src/java/org/apache/cassandra/gms/EndpointState.java index 0e643cd160..1cd8e7f565 100644 --- a/src/java/org/apache/cassandra/gms/EndpointState.java +++ b/src/java/org/apache/cassandra/gms/EndpointState.java @@ -41,7 +41,7 @@ public class EndpointState private volatile HeartBeatState hbState; final Map applicationState = new NonBlockingHashMap(); - + /* fields below do not get serialized */ private volatile long updateTimestamp; private volatile boolean isAlive; @@ -50,19 +50,19 @@ public class EndpointState { return serializer; } - + EndpointState(HeartBeatState initialHbState) - { + { hbState = initialHbState; updateTimestamp = System.currentTimeMillis(); isAlive = true; } - + HeartBeatState getHeartBeatState() { return hbState; } - + void setHeartBeatState(HeartBeatState newHbState) { updateTimestamp(); @@ -82,7 +82,7 @@ public class EndpointState { return applicationState; } - + void addApplicationState(ApplicationState key, VersionedValue value) { applicationState.put(key, value); @@ -93,14 +93,14 @@ public class EndpointState { return updateTimestamp; } - + void updateTimestamp() { updateTimestamp = System.currentTimeMillis(); } - + public boolean isAlive() - { + { return isAlive; } @@ -110,7 +110,7 @@ public class EndpointState } void markDead() - { + { isAlive = false; } } @@ -118,7 +118,7 @@ public class EndpointState class EndpointStateSerializer implements IVersionedSerializer { private static Logger logger = LoggerFactory.getLogger(EndpointStateSerializer.class); - + public void serialize(EndpointState epState, DataOutput dos, int version) throws IOException { /* serialize the HeartBeatState */ diff --git a/src/java/org/apache/cassandra/gms/FailureDetector.java b/src/java/org/apache/cassandra/gms/FailureDetector.java index 191f743aa2..c8ba43a4c9 100644 --- a/src/java/org/apache/cassandra/gms/FailureDetector.java +++ b/src/java/org/apache/cassandra/gms/FailureDetector.java @@ -38,7 +38,7 @@ import org.apache.cassandra.utils.FBUtilities; /** * This FailureDetector is an implementation of the paper titled - * "The Phi Accrual Failure Detector" by Hayashibara. + * "The Phi Accrual Failure Detector" by Hayashibara. * Check the paper and the IFailureDetector interface for details. */ public class FailureDetector implements IFailureDetector, FailureDetectorMBean @@ -51,7 +51,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean private Map arrivalSamples_ = new Hashtable(); private List fdEvntListeners_ = new CopyOnWriteArrayList(); - + public FailureDetector() { phiConvictThreshold_ = DatabaseDescriptor.getPhiConvictThreshold(); @@ -66,7 +66,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean throw new RuntimeException(e); } } - + public String getAllEndpointStates() { StringBuilder sb = new StringBuilder(); @@ -126,7 +126,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean FileUtils.closeQuietly(os); } } - + public void setPhiConvictThreshold(int phi) { phiConvictThreshold_ = phi; @@ -136,7 +136,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean { return phiConvictThreshold_; } - + public boolean isAlive(InetAddress ep) { if (ep.equals(FBUtilities.getBroadcastAddress())) @@ -171,19 +171,19 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean } heartbeatWindow.add(now); } - + public void interpret(InetAddress ep) { ArrivalWindow hbWnd = arrivalSamples_.get(ep); if ( hbWnd == null ) - { + { return; } long now = System.currentTimeMillis(); double phi = hbWnd.phi(now); if (logger_.isTraceEnabled()) logger_.trace("PHI for " + ep + " : " + phi); - + if ( phi > phiConvictThreshold_ ) { logger_.trace("notifying listeners that {} is down", ep); @@ -192,29 +192,29 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean { listener.convict(ep, phi); } - } + } } public void remove(InetAddress ep) { arrivalSamples_.remove(ep); } - + public void registerFailureDetectionEventListener(IFailureDetectionEventListener listener) { fdEvntListeners_.add(listener); } - + public void unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener) { fdEvntListeners_.remove(listener); } - + public String toString() { StringBuilder sb = new StringBuilder(); Set eps = arrivalSamples_.keySet(); - + sb.append("-----------------------------------------------------------------------"); for ( InetAddress ep : eps ) { @@ -226,9 +226,9 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean sb.append("-----------------------------------------------------------------------"); return sb.toString(); } - + public static void main(String[] args) throws Throwable - { + { } } @@ -253,12 +253,12 @@ class ArrivalWindow { arrivalIntervals_ = new BoundedStatsDeque(size); } - + synchronized void add(double value) { double interArrivalTime; if ( tLast_ > 0L ) - { + { interArrivalTime = (value - tLast_); } else @@ -271,32 +271,32 @@ class ArrivalWindow logger_.debug("Ignoring interval time of {}", interArrivalTime); tLast_ = value; } - + synchronized double sum() { return arrivalIntervals_.sum(); } - + synchronized double sumOfDeviations() { return arrivalIntervals_.sumOfDeviations(); } - + synchronized double mean() { return arrivalIntervals_.mean(); } - + synchronized double variance() { return arrivalIntervals_.variance(); } - + double stdev() { return arrivalIntervals_.stdev(); } - + void clear() { arrivalIntervals_.clear(); @@ -311,7 +311,7 @@ class ArrivalWindow ? PHI_FACTOR * t / mean() : 0.0; } - + public String toString() { return StringUtils.join(arrivalIntervals_.iterator(), " "); diff --git a/src/java/org/apache/cassandra/gms/GossipDigest.java b/src/java/org/apache/cassandra/gms/GossipDigest.java index 3881fa87ab..4fe211881f 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigest.java +++ b/src/java/org/apache/cassandra/gms/GossipDigest.java @@ -25,7 +25,7 @@ import org.apache.cassandra.io.IVersionedSerializer; import org.apache.cassandra.net.CompactEndpointSerializationHelper; /** - * Contains information about a specified list of Endpoints and the largest version + * Contains information about a specified list of Endpoints and the largest version * of the state they have generated as known by the local endpoint. */ @@ -36,7 +36,7 @@ public class GossipDigest implements Comparable { serializer = new GossipDigestSerializer(); } - + InetAddress endpoint; int generation; int maxVersion; @@ -45,36 +45,36 @@ public class GossipDigest implements Comparable { return serializer; } - + GossipDigest(InetAddress ep, int gen, int version) { endpoint = ep; generation = gen; maxVersion = version; } - + InetAddress getEndpoint() { return endpoint; } - + int getGeneration() { return generation; } - + int getMaxVersion() { return maxVersion; } - + public int compareTo(GossipDigest gDigest) { if ( generation != gDigest.generation ) return ( generation - gDigest.generation ); return (maxVersion - gDigest.maxVersion); } - + public String toString() { StringBuilder sb = new StringBuilder(); @@ -88,9 +88,9 @@ public class GossipDigest implements Comparable } class GossipDigestSerializer implements IVersionedSerializer -{ +{ public void serialize(GossipDigest gDigest, DataOutput dos, int version) throws IOException - { + { CompactEndpointSerializationHelper.serialize(gDigest.endpoint, dos); dos.writeInt(gDigest.generation); dos.writeInt(gDigest.maxVersion); diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java b/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java index c2d0716453..bf9577290e 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java +++ b/src/java/org/apache/cassandra/gms/GossipDigestAck2Message.java @@ -27,7 +27,7 @@ import org.apache.cassandra.io.IVersionedSerializer; /** - * This message gets sent out as a result of the receipt of a GossipDigestAckMessage. This the + * This message gets sent out as a result of the receipt of a GossipDigestAckMessage. This the * last stage of the 3 way messaging of the Gossip protocol. */ @@ -38,19 +38,19 @@ class GossipDigestAck2Message { serializer_ = new GossipDigestAck2MessageSerializer(); } - + Map epStateMap_ = new HashMap(); public static IVersionedSerializer serializer() { return serializer_; } - + GossipDigestAck2Message(Map epStateMap) { epStateMap_ = epStateMap; } - + Map getEndpointStateMap() { return epStateMap_; @@ -68,7 +68,7 @@ class GossipDigestAck2MessageSerializer implements IVersionedSerializer epStateMap = EndpointStatesSerializationHelper.deserialize(dis, version); - return new GossipDigestAck2Message(epStateMap); + return new GossipDigestAck2Message(epStateMap); } public long serializedSize(GossipDigestAck2Message gossipDigestAck2Message, int version) diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAck2VerbHandler.java b/src/java/org/apache/cassandra/gms/GossipDigestAck2VerbHandler.java index f1024253d7..e9108e9542 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigestAck2VerbHandler.java +++ b/src/java/org/apache/cassandra/gms/GossipDigestAck2VerbHandler.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java b/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java index 0592c2003c..9dd09a0683 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java +++ b/src/java/org/apache/cassandra/gms/GossipDigestAckMessage.java @@ -41,26 +41,26 @@ class GossipDigestAckMessage { serializer_ = new GossipDigestAckMessageSerializer(); } - + List gDigestList_ = new ArrayList(); Map epStateMap_ = new HashMap(); - + static IVersionedSerializer serializer() { return serializer_; } - + GossipDigestAckMessage(List gDigestList, Map epStateMap) { gDigestList_ = gDigestList; epStateMap_ = epStateMap; } - + List getGossipDigestList() { return gDigestList_; } - + Map getEndpointStateMap() { return epStateMap_; diff --git a/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java b/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java index 2888863527..7ea8de2316 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java +++ b/src/java/org/apache/cassandra/gms/GossipDigestAckVerbHandler.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java b/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java index d003c0f29c..c2aadb5323 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java +++ b/src/java/org/apache/cassandra/gms/GossipDigestSynMessage.java @@ -34,8 +34,8 @@ import org.apache.cassandra.net.CompactEndpointSerializationHelper; /** - * This is the first message that gets sent out as a start of the Gossip protocol in a - * round. + * This is the first message that gets sent out as a start of the Gossip protocol in a + * round. */ class GossipDigestSynMessage @@ -45,7 +45,7 @@ class GossipDigestSynMessage { serializer_ = new GossipDigestSynMessageSerializer(); } - + String clusterId_; List gDigests_ = new ArrayList(); @@ -53,13 +53,13 @@ class GossipDigestSynMessage { return serializer_; } - + public GossipDigestSynMessage(String clusterId, List gDigests) - { + { clusterId_ = clusterId; gDigests_ = gDigests; } - + List getGossipDigests() { return gDigests_; @@ -69,7 +69,7 @@ class GossipDigestSynMessage class GossipDigestSerializationHelper { private static Logger logger_ = LoggerFactory.getLogger(GossipDigestSerializationHelper.class); - + static void serialize(List gDigestList, DataOutput dos, int version) throws IOException { dos.writeInt(gDigestList.size()); @@ -81,13 +81,13 @@ class GossipDigestSerializationHelper static List deserialize(DataInput dis, int version) throws IOException { - int size = dis.readInt(); + int size = dis.readInt(); List gDigests = new ArrayList(size); - + for ( int i = 0; i < size; ++i ) { gDigests.add(GossipDigest.serializer().deserialize(dis, version)); - } + } return gDigests; } } @@ -109,7 +109,7 @@ class EndpointStatesSerializationHelper static Map deserialize(DataInput dis, int version) throws IOException { - int size = dis.readInt(); + int size = dis.readInt(); Map epStateMap = new HashMap(size); for ( int i = 0; i < size; ++i ) @@ -123,9 +123,9 @@ class EndpointStatesSerializationHelper } class GossipDigestSynMessageSerializer implements IVersionedSerializer -{ +{ public void serialize(GossipDigestSynMessage gDigestSynMessage, DataOutput dos, int version) throws IOException - { + { dos.writeUTF(gDigestSynMessage.clusterId_); GossipDigestSerializationHelper.serialize(gDigestSynMessage.gDigests_, dos, version); } diff --git a/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java b/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java index 026f3fee4e..bb0f3979a7 100644 --- a/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java +++ b/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index b2dae2fe99..9db156ec54 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -66,7 +66,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean private static final DebuggableScheduledThreadPoolExecutor executor = new DebuggableScheduledThreadPoolExecutor("GossipTasks"); static final ApplicationState[] STATES = ApplicationState.values(); - static final List DEAD_STATES = Arrays.asList(VersionedValue.REMOVING_TOKEN, VersionedValue.REMOVED_TOKEN, + static final List DEAD_STATES = Arrays.asList(VersionedValue.REMOVING_TOKEN, VersionedValue.REMOVED_TOKEN, VersionedValue.STATUS_LEFT, VersionedValue.HIBERNATE); private ScheduledFuture scheduledGossipTask; @@ -75,7 +75,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean private static Logger logger = LoggerFactory.getLogger(Gossiper.class); public static final Gossiper instance = new Gossiper(); - public static final long aVeryLongTime = 259200 * 1000; // 3 days + public static final long aVeryLongTime = 259200 * 1000; // 3 days private long FatClientTimeout; private Random random = new Random(); private Comparator inetcomparator = new Comparator() @@ -106,9 +106,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean * after removal to prevent nodes from falsely reincarnating during the time when removal * gossip gets propagated to all nodes */ private Map justRemovedEndpoints = new ConcurrentHashMap(); - + private Map expireTimeEndpointMap = new ConcurrentHashMap(); - + // protocol versions of the other nodes in the cluster private final ConcurrentMap versions = new NonBlockingHashMap(); @@ -120,7 +120,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean { //wait on messaging service to start listening MessagingService.instance().waitUntilListening(); - + /* Update the local heartbeat counter. */ endpointStateMap.get(FBUtilities.getBroadcastAddress()).getHeartBeatState().updateHeartBeat(); if (logger.isTraceEnabled()) @@ -210,13 +210,13 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean { subscribers.remove(subscriber); } - + public void setVersion(InetAddress address, int version) { logger.debug("Setting version {} for {}", version, address); versions.put(address, version); } - + public void resetVersion(InetAddress endpoint) { logger.debug("Reseting version for {}", endpoint); @@ -235,7 +235,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean else return v; } - + public Set getLiveMembers() { @@ -551,7 +551,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean catch (IOException ex) { throw new IOError(ex); - } + } return seeds.contains(to); } @@ -643,7 +643,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean } } } - + if (!justRemovedEndpoints.isEmpty()) { for (Entry entry : justRemovedEndpoints.entrySet()) @@ -657,7 +657,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean } } } - + protected long getExpireTimeForEndpoint(InetAddress endpoint) { /* default expireTime is aVeryLongTime */ @@ -728,7 +728,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean EndpointState ep2 = getEndpointStateForEndpoint(addr2); assert ep1 != null && ep2 != null; return ep1.getHeartBeatState().getGeneration() - ep2.getHeartBeatState().getGeneration(); - } + } void notifyFailureDetector(List gDigests) { @@ -1070,9 +1070,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean Gossiper.intervalInMillis, TimeUnit.MILLISECONDS); } - + // initialize local HB state if needed. - public void maybeInitializeLocalState(int generationNbr) + public void maybeInitializeLocalState(int generationNbr) { EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress()); if ( localState == null ) @@ -1083,7 +1083,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean endpointStateMap.put(FBUtilities.getBroadcastAddress(), localState); } } - + /** * Add an endpoint we knew about previously, but whose state is unknown @@ -1150,7 +1150,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean { return getCurrentGenerationNumber(InetAddress.getByName(address)); } - + public void addExpireTimeForEndpoint(InetAddress endpoint, long expireTime) { if (logger.isDebugEnabled()) @@ -1159,7 +1159,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean } expireTimeEndpointMap.put(endpoint, expireTime); } - + public static long computeExpireTime() { return System.currentTimeMillis() + Gossiper.aVeryLongTime; } diff --git a/src/java/org/apache/cassandra/gms/HeartBeatState.java b/src/java/org/apache/cassandra/gms/HeartBeatState.java index a71fead952..7023f00a60 100644 --- a/src/java/org/apache/cassandra/gms/HeartBeatState.java +++ b/src/java/org/apache/cassandra/gms/HeartBeatState.java @@ -24,18 +24,18 @@ import org.apache.cassandra.io.IVersionedSerializer; /** - * HeartBeat State associated with any given endpoint. + * HeartBeat State associated with any given endpoint. */ class HeartBeatState { private static IVersionedSerializer serializer; - + static { serializer = new HeartBeatStateSerializer(); } - + private int generation; private int version; @@ -43,7 +43,7 @@ class HeartBeatState { this(gen, 0); } - + HeartBeatState(int gen, int ver) { generation = gen; @@ -54,7 +54,7 @@ class HeartBeatState { return serializer; } - + int getGeneration() { return generation; @@ -64,7 +64,7 @@ class HeartBeatState { version = VersionGenerator.getNextVersion(); } - + int getHeartBeatVersion() { return version; @@ -83,7 +83,7 @@ class HeartBeatStateSerializer implements IVersionedSerializer dos.writeInt(hbState.getGeneration()); dos.writeInt(hbState.getHeartBeatVersion()); } - + public HeartBeatState deserialize(DataInput dis, int version) throws IOException { return new HeartBeatState(dis.readInt(), dis.readInt()); diff --git a/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java b/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java index 17c69a7aa0..60e5f2b702 100644 --- a/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java +++ b/src/java/org/apache/cassandra/gms/IEndpointStateChangeSubscriber.java @@ -25,7 +25,7 @@ import java.net.InetAddress; * interested parties about changes in the the state associated with any endpoint. * For instance if node A figures there is a changes in state for an endpoint B * it notifies all interested parties of this change. It is upto to the registered - * instance to decide what he does with this change. Not all modules maybe interested + * instance to decide what he does with this change. Not all modules maybe interested * in all state changes. */ @@ -34,7 +34,7 @@ public interface IEndpointStateChangeSubscriber /** * Use to inform interested parties about the change in the state * for specified endpoint - * + * * @param endpoint endpoint for which the state change occurred. * @param epState state that actually changed for the above endpoint. */ diff --git a/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java b/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java index c436211928..717bac5a06 100644 --- a/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java +++ b/src/java/org/apache/cassandra/gms/IFailureDetectionEventListener.java @@ -27,7 +27,7 @@ import java.net.InetAddress; */ public interface IFailureDetectionEventListener -{ +{ /** * Convict the specified endpoint. * @param ep endpoint to be convicted diff --git a/src/java/org/apache/cassandra/gms/IFailureDetector.java b/src/java/org/apache/cassandra/gms/IFailureDetector.java index df12bb497a..d5bf9ecfe1 100644 --- a/src/java/org/apache/cassandra/gms/IFailureDetector.java +++ b/src/java/org/apache/cassandra/gms/IFailureDetector.java @@ -22,7 +22,7 @@ import java.net.InetAddress; /** * An interface that provides an application with the ability - * to query liveness information of a node in the cluster. It + * to query liveness information of a node in the cluster. It * also exposes methods which help an application register callbacks * for notifications of liveness information of nodes. */ @@ -32,7 +32,7 @@ public interface IFailureDetector /** * Failure Detector's knowledge of whether a node is up or * down. - * + * * @param ep endpoint in question. * @return true if UP and false if DOWN. */ @@ -45,19 +45,19 @@ public interface IFailureDetector public void clear(InetAddress ep); /** - * This method is invoked by any entity wanting to interrogate the status of an endpoint. + * This method is invoked by any entity wanting to interrogate the status of an endpoint. * In our case it would be the Gossiper. The Failure Detector will then calculate Phi and - * deem an endpoint as suspicious or alive as explained in the Hayashibara paper. - * + * deem an endpoint as suspicious or alive as explained in the Hayashibara paper. + * * param ep endpoint for which we interpret the inter arrival times. */ public void interpret(InetAddress ep); - + /** * This method is invoked by the receiver of the heartbeat. In our case it would be * the Gossiper. Gossiper inform the Failure Detector on receipt of a heartbeat. The * FailureDetector will then sample the arrival time as explained in the paper. - * + * * param ep endpoint being reported. */ public void report(InetAddress ep); @@ -66,16 +66,16 @@ public interface IFailureDetector * remove endpoint from failure detector */ public void remove(InetAddress ep); - + /** - * Register interest for Failure Detector events. - * @param listener implementation of an application provided IFailureDetectionEventListener + * Register interest for Failure Detector events. + * @param listener implementation of an application provided IFailureDetectionEventListener */ public void registerFailureDetectionEventListener(IFailureDetectionEventListener listener); - + /** - * Un-register interest for Failure Detector events. - * @param listener implementation of an application provided IFailureDetectionEventListener + * Un-register interest for Failure Detector events. + * @param listener implementation of an application provided IFailureDetectionEventListener */ public void unregisterFailureDetectionEventListener(IFailureDetectionEventListener listener); } diff --git a/src/java/org/apache/cassandra/gms/IFailureNotification.java b/src/java/org/apache/cassandra/gms/IFailureNotification.java index 1d09bf00e2..f2e801f384 100644 --- a/src/java/org/apache/cassandra/gms/IFailureNotification.java +++ b/src/java/org/apache/cassandra/gms/IFailureNotification.java @@ -21,7 +21,7 @@ package org.apache.cassandra.gms; import java.net.InetAddress; public interface IFailureNotification -{ +{ public void convict(InetAddress ep); public void revive(InetAddress ep); } diff --git a/src/java/org/apache/cassandra/gms/VersionGenerator.java b/src/java/org/apache/cassandra/gms/VersionGenerator.java index aaf75b06de..77138de87c 100644 --- a/src/java/org/apache/cassandra/gms/VersionGenerator.java +++ b/src/java/org/apache/cassandra/gms/VersionGenerator.java @@ -21,14 +21,14 @@ package org.apache.cassandra.gms; import java.util.concurrent.atomic.AtomicInteger; /** - * A unique version number generator for any state that is generated by the + * A unique version number generator for any state that is generated by the * local node. */ public class VersionGenerator { private static AtomicInteger version_ = new AtomicInteger(0); - + public static int getNextVersion() { return version_.incrementAndGet(); diff --git a/src/java/org/apache/cassandra/gms/VersionedValue.java b/src/java/org/apache/cassandra/gms/VersionedValue.java index d4eca8e61f..85c9b3830c 100644 --- a/src/java/org/apache/cassandra/gms/VersionedValue.java +++ b/src/java/org/apache/cassandra/gms/VersionedValue.java @@ -30,12 +30,12 @@ import org.apache.cassandra.utils.FBUtilities; /** * This abstraction represents the state associated with a particular node which an - * application wants to make available to the rest of the nodes in the cluster. + * application wants to make available to the rest of the nodes in the cluster. * Whenever a piece of state needs to be disseminated to the rest of cluster wrap * the state in an instance of ApplicationState and add it to the Gossiper. - * + * * e.g. if we want to disseminate load information for node A do the following: - * + * * ApplicationState loadState = new ApplicationState(); * Gossiper.instance.addApplicationState("LOAD STATE", loadState); */ diff --git a/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java b/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java index ab2bae1a48..2bea14e8f4 100644 --- a/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java +++ b/src/java/org/apache/cassandra/hadoop/BulkOutputFormat.java @@ -1,7 +1,7 @@ package org.apache.cassandra.hadoop; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.hadoop; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.IOException; @@ -38,7 +38,7 @@ public class BulkOutputFormat extends OutputFormat> implements org.apache.hadoop.mapred.OutputFormat> { private static final Logger logger = LoggerFactory.getLogger(BulkOutputFormat.class); - + @Override public void checkOutputSpecs(JobContext context) { @@ -58,7 +58,7 @@ public class BulkOutputFormat extends OutputFormat> { return new NullOutputCommitter(); } - + /** Fills the deprecated OutputFormat interface for streaming. */ @Deprecated public void checkOutputSpecs(org.apache.hadoop.fs.FileSystem filesystem, org.apache.hadoop.mapred.JobConf job) throws IOException diff --git a/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java b/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java index 71ea2f4b3d..74f1158b48 100644 --- a/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java +++ b/src/java/org/apache/cassandra/hadoop/BulkRecordWriter.java @@ -1,7 +1,7 @@ package org.apache.cassandra.hadoop; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.hadoop; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.File; @@ -78,7 +78,7 @@ implements org.apache.hadoop.mapred.RecordWriter> { this(context.getConfiguration()); } - + BulkRecordWriter(Configuration conf) throws IOException { Config.setLoadYaml(false); diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java index 5bef55ba8c..60f6af75b1 100644 --- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java +++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java @@ -237,10 +237,10 @@ public class ColumnFamilyInputFormat extends InputFormat * As is the case with the {@link ColumnFamilyInputFormat}, you need to set the * Keyspace and ColumnFamily in your @@ -51,7 +51,7 @@ import org.apache.thrift.transport.TSocket; * {@link ConfigHelper#setOutputColumnFamily} method, is provided to make this * simple. *

- * + * *

* For the sake of performance, this class employs a lazy write-back caching * mechanism, where its record writer batches mutations created based on the @@ -63,13 +63,13 @@ public class ColumnFamilyOutputFormat extends OutputFormat> { private static final Logger logger = LoggerFactory.getLogger(ColumnFamilyOutputFormat.class); - + public static final String BATCH_THRESHOLD = "mapreduce.output.columnfamilyoutputformat.batch.threshold"; public static final String QUEUE_SIZE = "mapreduce.output.columnfamilyoutputformat.queue.size"; /** * Check for validity of the output-specification for the job. - * + * * @param context * information about the job * @throws IOException @@ -95,7 +95,7 @@ public class ColumnFamilyOutputFormat extends OutputFormat * Furthermore, this writer groups the mutations by the endpoint responsible for * the rows being affected. This allows the mutations to be executed in parallel, * directly to a responsible endpoint. *

- * + * * @see ColumnFamilyOutputFormat * @see OutputFormat - * + * */ final class ColumnFamilyRecordWriter extends RecordWriter> implements org.apache.hadoop.mapred.RecordWriter> { // The configuration this writer is associated with. private final Configuration conf; - + // The ring cache that describes the token ranges each node in the ring is // responsible for. This is what allows us to group the mutations by // the endpoints they should be targeted at. The targeted endpoint // essentially // acts as the primary replica for the rows being affected by the mutations. private final RingCache ringCache; - + // The number of mutations to buffer per endpoint private final int queueSize; // handles for clients for each range running in the threadpool private final Map clients; private final long batchThreshold; - + private final ConsistencyLevel consistencyLevel; /** * Upon construction, obtain the map that this writer will use to collect * mutations, and the ring cache for the given keyspace. - * + * * @param context the task attempt context * @throws IOException */ @@ -92,7 +92,7 @@ implements org.apache.hadoop.mapred.RecordWriter> { this(context.getConfiguration()); } - + ColumnFamilyRecordWriter(Configuration conf) throws IOException { this.conf = conf; @@ -110,7 +110,7 @@ implements org.apache.hadoop.mapred.RecordWriter> * {@link Deletion}. Similarly, if the entire value for a key is missing * (i.e., null), then the entire key is marked for {@link Deletion}. *

- * + * * @param keybuff * the key to write. * @param value diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java index 110bc11f67..71a1c3412c 100644 --- a/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java +++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java @@ -1,6 +1,6 @@ package org.apache.cassandra.hadoop; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.hadoop; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -55,7 +55,7 @@ public class ColumnFamilySplit extends InputSplit implements Writable, org.apach } // getLength and getLocations satisfy the InputSplit abstraction - + public long getLength() { // only used for sorting splits. we don't have the capability, yet. diff --git a/src/java/org/apache/cassandra/hadoop/ConfigHelper.java b/src/java/org/apache/cassandra/hadoop/ConfigHelper.java index c9ab70e4e7..b2903a14d0 100644 --- a/src/java/org/apache/cassandra/hadoop/ConfigHelper.java +++ b/src/java/org/apache/cassandra/hadoop/ConfigHelper.java @@ -1,6 +1,6 @@ package org.apache.cassandra.hadoop; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.hadoop; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.IOException; @@ -73,7 +73,7 @@ public class ConfigHelper private static final String WRITE_CONSISTENCY_LEVEL = "cassandra.consistencylevel.write"; private static final String OUTPUT_COMPRESSION_CLASS = "cassandra.output.compression.class"; private static final String OUTPUT_COMPRESSION_CHUNK_LENGTH = "cassandra.output.compression.length"; - + private static final Logger logger = LoggerFactory.getLogger(ConfigHelper.class); @@ -197,7 +197,7 @@ public class ConfigHelper String s = conf.get(INPUT_PREDICATE_CONFIG); return s == null ? null : predicateFromString(s); } - + private static String thriftToString(TBase object) { assert object != null; @@ -286,17 +286,17 @@ public class ConfigHelper { return conf.get(INPUT_KEYSPACE_CONFIG); } - + public static String getOutputKeyspace(Configuration conf) { return conf.get(OUTPUT_KEYSPACE_CONFIG); } - + public static String getInputKeyspaceUserName(Configuration conf) { return conf.get(INPUT_KEYSPACE_USERNAME_CONFIG); } - + public static String getInputKeyspacePassword(Configuration conf) { return conf.get(INPUT_KEYSPACE_PASSWD_CONFIG); @@ -306,7 +306,7 @@ public class ConfigHelper { return conf.get(OUTPUT_KEYSPACE_USERNAME_CONFIG); } - + public static String getOutputKeyspacePassword(Configuration conf) { return conf.get(OUTPUT_KEYSPACE_PASSWD_CONFIG); @@ -321,7 +321,7 @@ public class ConfigHelper { return Boolean.valueOf(conf.get(INPUT_WIDEROWS_CONFIG)); } - + public static String getOutputColumnFamily(Configuration conf) { return conf.get(OUTPUT_COLUMNFAMILY_CONFIG); @@ -373,7 +373,7 @@ public class ConfigHelper throw new RuntimeException(e); } } - + public static int getOutputRpcPort(Configuration conf) { return Integer.parseInt(conf.get(OUTPUT_THRIFT_PORT, "9160")); diff --git a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java index e96d15bfec..42eb2f94da 100644 --- a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java +++ b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java @@ -5,9 +5,9 @@ * licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -79,7 +79,7 @@ public class CassandraStorage extends LoadFunc implements StoreFuncInterface, Lo private final static String DEFAULT_INPUT_FORMAT = "org.apache.cassandra.hadoop.ColumnFamilyInputFormat"; private final static String DEFAULT_OUTPUT_FORMAT = "org.apache.cassandra.hadoop.ColumnFamilyOutputFormat"; - + private final static ByteBuffer BOUND = ByteBufferUtil.EMPTY_BYTE_BUFFER; private static final Log logger = LogFactory.getLog(CassandraStorage.class); @@ -113,7 +113,7 @@ public class CassandraStorage extends LoadFunc implements StoreFuncInterface, Lo this.limit = limit; } - public int getLimit() + public int getLimit() { return limit; } @@ -382,7 +382,7 @@ public class CassandraStorage extends LoadFunc implements StoreFuncInterface, Lo if (System.getenv(PIG_ALLOW_DELETES) != null) allow_deletes = Boolean.valueOf(System.getenv(PIG_ALLOW_DELETES)); } - + private String getFullyQualifiedClassName(String classname) { return classname.contains(".") ? classname : "org.apache.cassandra.hadoop." + classname; diff --git a/src/java/org/apache/cassandra/io/ISerializer.java b/src/java/org/apache/cassandra/io/ISerializer.java index f4e165e2b7..2419221a5a 100644 --- a/src/java/org/apache/cassandra/io/ISerializer.java +++ b/src/java/org/apache/cassandra/io/ISerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/IVersionedSerializer.java b/src/java/org/apache/cassandra/io/IVersionedSerializer.java index 254b111266..23c55bf139 100644 --- a/src/java/org/apache/cassandra/io/IVersionedSerializer.java +++ b/src/java/org/apache/cassandra/io/IVersionedSerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java index 545b09ec89..6a466f7be1 100644 --- a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java +++ b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java @@ -53,7 +53,7 @@ public class CompressedSequentialWriter extends SequentialWriter private long originalSize = 0, compressedSize = 0; private Collector sstableMetadataCollector; - + public CompressedSequentialWriter(File file, String indexFilePath, boolean skipIOCache, CompressionParameters parameters, Collector sstableMetadataCollector) throws IOException { super(file, parameters.chunkLength(), skipIOCache); @@ -90,7 +90,7 @@ public class CompressedSequentialWriter extends SequentialWriter originalSize += validBufferBytes; compressedSize += compressedLength; - + // update checksum checksum.update(buffer, 0, validBufferBytes); diff --git a/src/java/org/apache/cassandra/io/sstable/BloomFilterTracker.java b/src/java/org/apache/cassandra/io/sstable/BloomFilterTracker.java index 80fdc7ccda..400bee8046 100644 --- a/src/java/org/apache/cassandra/io/sstable/BloomFilterTracker.java +++ b/src/java/org/apache/cassandra/io/sstable/BloomFilterTracker.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/sstable/Component.java b/src/java/org/apache/cassandra/io/sstable/Component.java index 9b85ace8bd..45172443e3 100644 --- a/src/java/org/apache/cassandra/io/sstable/Component.java +++ b/src/java/org/apache/cassandra/io/sstable/Component.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.io.sstable; @@ -61,7 +61,7 @@ public class Component { this.repr = repr; } - + static Type fromRepresentation(String repr) { for (Type type : TYPES) diff --git a/src/java/org/apache/cassandra/io/sstable/Descriptor.java b/src/java/org/apache/cassandra/io/sstable/Descriptor.java index 078e2f240e..cf767ff2fd 100644 --- a/src/java/org/apache/cassandra/io/sstable/Descriptor.java +++ b/src/java/org/apache/cassandra/io/sstable/Descriptor.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -117,7 +117,7 @@ public class Descriptor { return filenameFor(component.name()); } - + private String baseFilename() { StringBuilder buff = new StringBuilder(); diff --git a/src/java/org/apache/cassandra/io/sstable/KeyIterator.java b/src/java/org/apache/cassandra/io/sstable/KeyIterator.java index dd08421c52..7de27aff08 100644 --- a/src/java/org/apache/cassandra/io/sstable/KeyIterator.java +++ b/src/java/org/apache/cassandra/io/sstable/KeyIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/sstable/ReducingKeyIterator.java b/src/java/org/apache/cassandra/io/sstable/ReducingKeyIterator.java index aa2618d212..5c792d2621 100644 --- a/src/java/org/apache/cassandra/io/sstable/ReducingKeyIterator.java +++ b/src/java/org/apache/cassandra/io/sstable/ReducingKeyIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/sstable/SSTable.java b/src/java/org/apache/cassandra/io/sstable/SSTable.java index ff0ea6f1dc..31f961fae2 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTable.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTable.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java b/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java index 3355fca507..fbb0788ab7 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableIdentityIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java b/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java index 4e52993714..13fb8f2c8e 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableMetadata.java @@ -121,13 +121,13 @@ public class SSTableMetadata /** * Ratio is compressed/uncompressed and it is - * if you have 1.x then compression isn't helping + * if you have 1.x then compression isn't helping */ public void addCompressionRatio(long compressed, long uncompressed) { compressionRatio = (double) compressed/uncompressed; } - + public void updateMaxTimestamp(long potentialMax) { maxTimestamp = Math.max(maxTimestamp, potentialMax); diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java index 53980ed73d..25c158c86e 100644 --- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java +++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -103,7 +103,7 @@ public class SSTableWriter extends SSTable this.sstableMetadataCollector = sstableMetadataCollector; } - + public void mark() { dataMark = dataFile.mark(); diff --git a/src/java/org/apache/cassandra/io/util/BufferedSegmentedFile.java b/src/java/org/apache/cassandra/io/util/BufferedSegmentedFile.java index 31b4a6c6f8..7e4442fc47 100644 --- a/src/java/org/apache/cassandra/io/util/BufferedSegmentedFile.java +++ b/src/java/org/apache/cassandra/io/util/BufferedSegmentedFile.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/util/ColumnSortedMap.java b/src/java/org/apache/cassandra/io/util/ColumnSortedMap.java index a8104bc86f..d71556c9a2 100644 --- a/src/java/org/apache/cassandra/io/util/ColumnSortedMap.java +++ b/src/java/org/apache/cassandra/io/util/ColumnSortedMap.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java b/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java index bd988c1b9f..6248657e05 100644 --- a/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java +++ b/src/java/org/apache/cassandra/io/util/DataOutputBuffer.java @@ -31,12 +31,12 @@ public final class DataOutputBuffer extends DataOutputStream { this(128); } - + public DataOutputBuffer(int size) { super(new OutputBuffer(size)); } - + private OutputBuffer buffer() { return (OutputBuffer)out; @@ -50,13 +50,13 @@ public final class DataOutputBuffer extends DataOutputStream { return buffer().getData(); } - + /** Returns the length of the valid data currently in the buffer. */ public int getLength() { return buffer().getLength(); } - + /** Resets the buffer to empty. */ public DataOutputBuffer reset() { diff --git a/src/java/org/apache/cassandra/io/util/FastByteArrayInputStream.java b/src/java/org/apache/cassandra/io/util/FastByteArrayInputStream.java index a302eb3aaf..9515db7e46 100644 --- a/src/java/org/apache/cassandra/io/util/FastByteArrayInputStream.java +++ b/src/java/org/apache/cassandra/io/util/FastByteArrayInputStream.java @@ -26,14 +26,14 @@ import java.io.InputStream; * implementation. The synchronized methods of the original have been * replaced by non-synchronized methods. This makes this certain operations * FASTer, but also *not thread-safe*. - * + * * This file remains formatted the same as the Apache Harmony original to * make patching easier if any bug fixes are made to the Harmony version. */ /** * A specialized {@link InputStream } for reading the contents of a byte array. - * + * * @see ByteArrayInputStream */ public class FastByteArrayInputStream extends InputStream { @@ -62,7 +62,7 @@ public class FastByteArrayInputStream extends InputStream { /** * Constructs a new {@code ByteArrayInputStream} on the byte array * {@code buf}. - * + * * @param buf * the byte array to stream over. */ @@ -76,7 +76,7 @@ public class FastByteArrayInputStream extends InputStream { * Constructs a new {@code ByteArrayInputStream} on the byte array * {@code buf} with the initial position set to {@code offset} and the * number of bytes available set to {@code offset} + {@code length}. - * + * * @param buf * the byte array to stream over. * @param offset @@ -95,7 +95,7 @@ public class FastByteArrayInputStream extends InputStream { * Returns the number of bytes that are available before this stream will * block. This method returns the number of bytes yet to be read from the * source byte array. - * + * * @return the number of bytes available before blocking. */ @Override @@ -105,7 +105,7 @@ public class FastByteArrayInputStream extends InputStream { /** * Closes this stream and frees resources associated with this stream. - * + * * @throws IOException * if an I/O error occurs while closing this stream. */ @@ -118,7 +118,7 @@ public class FastByteArrayInputStream extends InputStream { * Sets a mark position in this ByteArrayInputStream. The parameter * {@code readlimit} is ignored. Sending {@code reset()} will reposition the * stream back to the marked position. - * + * * @param readlimit * ignored. * @see #markSupported() @@ -133,7 +133,7 @@ public class FastByteArrayInputStream extends InputStream { * Indicates whether this stream supports the {@code mark()} and * {@code reset()} methods. Returns {@code true} since this class supports * these methods. - * + * * @return always {@code true}. * @see #mark(int) * @see #reset() @@ -147,7 +147,7 @@ public class FastByteArrayInputStream extends InputStream { * Reads a single byte from the source byte array and returns it as an * integer in the range from 0 to 255. Returns -1 if the end of the source * array has been reached. - * + * * @return the byte read or -1 if the end of this stream has been reached. */ @Override @@ -159,7 +159,7 @@ public class FastByteArrayInputStream extends InputStream { * Reads at most {@code len} bytes from this stream and stores * them in byte array {@code b} starting at {@code offset}. This * implementation reads bytes from the source byte array. - * + * * @param b * the byte array in which to store the bytes read. * @param offset @@ -217,7 +217,7 @@ public class FastByteArrayInputStream extends InputStream { * {@code read()}s will not return these bytes unless {@code reset()} is * used. This implementation skips {@code count} number of bytes in the * target stream. It does nothing and returns 0 if {@code n} is negative. - * + * * @param n * the number of bytes to skip. * @return the number of bytes actually skipped. diff --git a/src/java/org/apache/cassandra/io/util/FastByteArrayOutputStream.java b/src/java/org/apache/cassandra/io/util/FastByteArrayOutputStream.java index 26d19c2a72..4ee034d81c 100644 --- a/src/java/org/apache/cassandra/io/util/FastByteArrayOutputStream.java +++ b/src/java/org/apache/cassandra/io/util/FastByteArrayOutputStream.java @@ -27,7 +27,7 @@ import java.io.UnsupportedEncodingException; * implementation. The synchronized methods of the original have been * replaced by non-synchronized methods. This makes certain operations * much FASTer, but also *not thread-safe*. - * + * * This file remains formatted the same as the Apache Harmony original to * make patching easier if any bug fixes are made to the Harmony version. */ @@ -37,7 +37,7 @@ import java.io.UnsupportedEncodingException; * (internal) byte array. As bytes are written to this stream, the byte array * may be expanded to hold more bytes. When the writing is considered to be * finished, a copy of the byte array can be requested from the class. - * + * * @see ByteArrayOutputStream */ public class FastByteArrayOutputStream extends OutputStream { @@ -64,7 +64,7 @@ public class FastByteArrayOutputStream extends OutputStream { * Constructs a new {@code ByteArrayOutputStream} with a default size of * {@code size} bytes. If more than {@code size} bytes are written to this * instance, the underlying byte array will expand. - * + * * @param size * initial size for the underlying byte array, must be * non-negative. @@ -81,7 +81,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Closes this stream. This releases system resources used for this stream. - * + * * @throws IOException * if an error occurs while attempting to close this stream. */ @@ -117,7 +117,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Returns the total number of bytes written to this stream so far. - * + * * @return the number of bytes written to this stream. */ public int size() { @@ -128,7 +128,7 @@ public class FastByteArrayOutputStream extends OutputStream { * Returns the contents of this ByteArrayOutputStream as a byte array. Any * changes made to the receiver after returning will not be reflected in the * byte array returned to the caller. - * + * * @return this stream's current contents as a byte array. */ public byte[] toByteArray() { @@ -141,7 +141,7 @@ public class FastByteArrayOutputStream extends OutputStream { * Returns the contents of this ByteArrayOutputStream as a string. Any * changes made to the receiver after returning will not be reflected in the * string returned to the caller. - * + * * @return this stream's current contents as a string. */ @@ -157,7 +157,7 @@ public class FastByteArrayOutputStream extends OutputStream { * {@code c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))}. This method is * deprecated and either {@link #toString()} or {@link #toString(String)} * should be used. - * + * * @param hibyte * the high byte of each resulting Unicode character. * @return this stream's current contents as a string with the high byte set @@ -176,7 +176,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Returns the contents of this ByteArrayOutputStream as a string converted * according to the encoding declared in {@code enc}. - * + * * @param enc * a string representing the encoding to use when translating * this stream to a string. @@ -191,7 +191,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Writes {@code count} bytes from the byte array {@code buffer} starting at * offset {@code index} to this stream. - * + * * @param buffer * the buffer to be written. * @param offset @@ -225,7 +225,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Writes the specified byte {@code oneByte} to the OutputStream. Only the * low order byte of {@code oneByte} is written. - * + * * @param oneByte * the byte to be written. */ @@ -240,7 +240,7 @@ public class FastByteArrayOutputStream extends OutputStream { /** * Takes the contents of this stream and writes it to the output stream * {@code out}. - * + * * @param out * an OutputStream on which to write the contents of this stream. * @throws IOException diff --git a/src/java/org/apache/cassandra/io/util/FileDataInput.java b/src/java/org/apache/cassandra/io/util/FileDataInput.java index 78720fa475..0059ce66bb 100644 --- a/src/java/org/apache/cassandra/io/util/FileDataInput.java +++ b/src/java/org/apache/cassandra/io/util/FileDataInput.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/util/FileMark.java b/src/java/org/apache/cassandra/io/util/FileMark.java index d45ab42be3..217c8075aa 100644 --- a/src/java/org/apache/cassandra/io/util/FileMark.java +++ b/src/java/org/apache/cassandra/io/util/FileMark.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ public interface FileMark {} diff --git a/src/java/org/apache/cassandra/io/util/FileUtils.java b/src/java/org/apache/cassandra/io/util/FileUtils.java index ff8544f5bf..d1349a2c97 100644 --- a/src/java/org/apache/cassandra/io/util/FileUtils.java +++ b/src/java/org/apache/cassandra/io/util/FileUtils.java @@ -54,7 +54,7 @@ public class FileUtils throw new IOException("Failed to delete " + file.getAbsolutePath()); } } - + public static void renameWithConfirm(File from, File to) throws IOException { assert from.exists(); @@ -213,12 +213,12 @@ public class FileUtils return val + " KB"; } else - { + { String val = df_.format(value); return val + " bytes"; - } + } } - + /** * Deletes all files and subdirectories under "dir". * @param dir Directory to be deleted diff --git a/src/java/org/apache/cassandra/io/util/IIterableColumns.java b/src/java/org/apache/cassandra/io/util/IIterableColumns.java index cb1b2f05d4..00b994fa51 100644 --- a/src/java/org/apache/cassandra/io/util/IIterableColumns.java +++ b/src/java/org/apache/cassandra/io/util/IIterableColumns.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/util/MemoryInputStream.java b/src/java/org/apache/cassandra/io/util/MemoryInputStream.java index d8ab08d0b0..0a7ece5f99 100644 --- a/src/java/org/apache/cassandra/io/util/MemoryInputStream.java +++ b/src/java/org/apache/cassandra/io/util/MemoryInputStream.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -30,14 +30,14 @@ public class MemoryInputStream extends AbstractDataInput { private final FreeableMemory mem; private int position = 0; - + public MemoryInputStream(FreeableMemory mem) { this.mem = mem; } - + public int read() throws IOException - { + { return mem.getByte(position++) & 0xFF; } @@ -51,18 +51,18 @@ public class MemoryInputStream extends AbstractDataInput { position = pos; } - + protected int getPosition() { return position; } - + public int skipBytes(int n) throws IOException { seekInternal(getPosition() + n); return position; } - + public void close() { // do nothing. diff --git a/src/java/org/apache/cassandra/io/util/MemoryOutputStream.java b/src/java/org/apache/cassandra/io/util/MemoryOutputStream.java index fd5bc33e40..496bffd620 100644 --- a/src/java/org/apache/cassandra/io/util/MemoryOutputStream.java +++ b/src/java/org/apache/cassandra/io/util/MemoryOutputStream.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -29,15 +29,15 @@ import java.io.OutputStream; */ public class MemoryOutputStream extends OutputStream { - + private final Memory mem; private int position = 0; - + public MemoryOutputStream(Memory mem) { this.mem = mem; } - + public void write(int b) { mem.setByte(position++, (byte) b); diff --git a/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java b/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java index 7d3fde7eb3..a933630a26 100644 --- a/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java +++ b/src/java/org/apache/cassandra/io/util/MmappedSegmentedFile.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.util; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.util; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/io/util/OutputBuffer.java b/src/java/org/apache/cassandra/io/util/OutputBuffer.java index ff7ef2d94c..2a644307ad 100644 --- a/src/java/org/apache/cassandra/io/util/OutputBuffer.java +++ b/src/java/org/apache/cassandra/io/util/OutputBuffer.java @@ -40,12 +40,12 @@ public final class OutputBuffer extends FastByteArrayOutputStream { return buf; } - + public int getLength() { return count; } - + public void write(DataInput in, int len) throws IOException { int newcount = count + len; @@ -58,7 +58,7 @@ public final class OutputBuffer extends FastByteArrayOutputStream in.readFully(buf, count, len); count = newcount; } - + /** * @return The valid contents of the buffer, possibly by copying: only safe for one-time-use buffers. */ diff --git a/src/java/org/apache/cassandra/io/util/SegmentedFile.java b/src/java/org/apache/cassandra/io/util/SegmentedFile.java index 2238dc4ceb..12878a4cce 100644 --- a/src/java/org/apache/cassandra/io/util/SegmentedFile.java +++ b/src/java/org/apache/cassandra/io/util/SegmentedFile.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java index 264e554843..e442851464 100644 --- a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java +++ b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java @@ -173,7 +173,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa { Double scored1 = scores.get(a1); Double scored2 = scores.get(a2); - + if (scored1 == null) { scored1 = 0.0; @@ -212,7 +212,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa private void updateScores() // this is expensive { - if (!StorageService.instance.isInitialized()) + if (!StorageService.instance.isInitialized()) return; if (!registered) { diff --git a/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java b/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java index b5a7deb298..68421f98ec 100644 --- a/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java +++ b/src/java/org/apache/cassandra/locator/Ec2MultiRegionSnitch.java @@ -1,6 +1,6 @@ package org.apache.cassandra.locator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.locator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -37,15 +37,15 @@ import org.apache.cassandra.service.StorageService; /** * 1) Snitch will automatically set the public IP by querying the AWS API - * + * * 2) Snitch will set the private IP as a Gossip application state. - * + * * 3) Snitch implements IESCS and will reset the connection if it is within the * same region to communicate via private IP. - * + * * Implements Ec2Snitch to inherit its functionality and extend it for * Multi-Region. - * + * * Operational: All the nodes in this cluster needs to be able to (modify the * Security group settings in AWS) communicate via Public IP's. */ @@ -65,7 +65,7 @@ public class Ec2MultiRegionSnitch extends Ec2Snitch implements IEndpointStateCha // use the Public IP to broadcast Address to other nodes. DatabaseDescriptor.setBroadcastAddress(public_ip); } - + @Override public void onJoin(InetAddress endpoint, EndpointState epState) { @@ -109,7 +109,7 @@ public class Ec2MultiRegionSnitch extends Ec2Snitch implements IEndpointStateCha { if (!getDatacenter(endpoint).equals(getDatacenter(public_ip))) return; // do nothing return back... - + try { InetAddress remoteIP = InetAddress.getByName(versionedValue.value); @@ -120,7 +120,7 @@ public class Ec2MultiRegionSnitch extends Ec2Snitch implements IEndpointStateCha logger.error("Error in getting the IP address resolved: ", e); } } - + public void gossiperStarting() { super.gossiperStarting(); diff --git a/src/java/org/apache/cassandra/locator/Ec2Snitch.java b/src/java/org/apache/cassandra/locator/Ec2Snitch.java index 3648143086..4ffc0e85a8 100644 --- a/src/java/org/apache/cassandra/locator/Ec2Snitch.java +++ b/src/java/org/apache/cassandra/locator/Ec2Snitch.java @@ -57,7 +57,7 @@ public class Ec2Snitch extends AbstractNetworkTopologySnitch ec2region = splits.length < 3 ? splits[0] : splits[0] + "-" + splits[1]; logger.info("EC2Snitch using region: " + ec2region + ", zone: " + ec2zone + "."); } - + String awsApiCall(String url) throws IOException, ConfigurationException { // Populate the region and zone by introspection, fail if 404 on metadata diff --git a/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java b/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java index c733ffbd18..7d7b190786 100644 --- a/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java +++ b/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java @@ -27,7 +27,7 @@ import java.net.UnknownHostException; public interface EndpointSnitchInfoMBean { /** - * Provides the Rack name depending on the respective snitch used, given the host name/ip + * Provides the Rack name depending on the respective snitch used, given the host name/ip * @param host * @throws UnknownHostException */ diff --git a/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java b/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java index 382e2247b3..8c85db8f54 100644 --- a/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java +++ b/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.locator; diff --git a/src/java/org/apache/cassandra/locator/SeedProvider.java b/src/java/org/apache/cassandra/locator/SeedProvider.java index 50737ac964..11bddc9fd8 100644 --- a/src/java/org/apache/cassandra/locator/SeedProvider.java +++ b/src/java/org/apache/cassandra/locator/SeedProvider.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/src/java/org/apache/cassandra/locator/SimpleSeedProvider.java b/src/java/org/apache/cassandra/locator/SimpleSeedProvider.java index 7f20da139f..ca71acaa42 100644 --- a/src/java/org/apache/cassandra/locator/SimpleSeedProvider.java +++ b/src/java/org/apache/cassandra/locator/SimpleSeedProvider.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,9 +32,9 @@ import org.slf4j.LoggerFactory; public class SimpleSeedProvider implements SeedProvider { private static final Logger logger = LoggerFactory.getLogger(SimpleSeedProvider.class); - + private List seeds; - + public SimpleSeedProvider(Map args) { seeds = new ArrayList(); @@ -52,12 +52,12 @@ public class SimpleSeedProvider implements SeedProvider } } } - + public List getSeeds() { return Collections.unmodifiableList(seeds); } - + // future planning? public void addSeed(InetAddress addr) { diff --git a/src/java/org/apache/cassandra/locator/TokenMetadata.java b/src/java/org/apache/cassandra/locator/TokenMetadata.java index 4d89f92bb9..65e60362cd 100644 --- a/src/java/org/apache/cassandra/locator/TokenMetadata.java +++ b/src/java/org/apache/cassandra/locator/TokenMetadata.java @@ -302,7 +302,7 @@ public class TokenMetadata { assert endpoint != null; assert isMember(endpoint); // don't want to return nulls - + lock.readLock().lock(); try { @@ -313,7 +313,7 @@ public class TokenMetadata lock.readLock().unlock(); } } - + public boolean isMember(InetAddress endpoint) { assert endpoint != null; diff --git a/src/java/org/apache/cassandra/net/AsyncResult.java b/src/java/org/apache/cassandra/net/AsyncResult.java index daab5255a4..b48fdcc2af 100644 --- a/src/java/org/apache/cassandra/net/AsyncResult.java +++ b/src/java/org/apache/cassandra/net/AsyncResult.java @@ -41,16 +41,16 @@ class AsyncResult implements IAsyncResult private InetAddress from; public AsyncResult() - { + { condition = lock.newCondition(); startTime = System.currentTimeMillis(); - } - + } + public byte[] get(long timeout, TimeUnit tu) throws TimeoutException { lock.lock(); try - { + { boolean bVal = true; try { @@ -65,9 +65,9 @@ class AsyncResult implements IAsyncResult { throw new AssertionError(ex); } - + if (!bVal && !done.get()) - { + { throw new TimeoutException("Operation timed out."); } } @@ -79,7 +79,7 @@ class AsyncResult implements IAsyncResult } public void result(Message response) - { + { try { lock.lock(); @@ -94,7 +94,7 @@ class AsyncResult implements IAsyncResult finally { lock.unlock(); - } + } } public boolean isLatencyForSnitch() diff --git a/src/java/org/apache/cassandra/net/CachingMessageProducer.java b/src/java/org/apache/cassandra/net/CachingMessageProducer.java index e8b5446e13..708dbbf3d4 100644 --- a/src/java/org/apache/cassandra/net/CachingMessageProducer.java +++ b/src/java/org/apache/cassandra/net/CachingMessageProducer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.net; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.net; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -32,7 +32,7 @@ public class CachingMessageProducer implements MessageProducer public CachingMessageProducer(MessageProducer prod) { - this.prod = prod; + this.prod = prod; } public synchronized Message getMessage(Integer version) throws IOException diff --git a/src/java/org/apache/cassandra/net/CallbackInfo.java b/src/java/org/apache/cassandra/net/CallbackInfo.java index 94ea5148ad..d5f698c552 100644 --- a/src/java/org/apache/cassandra/net/CallbackInfo.java +++ b/src/java/org/apache/cassandra/net/CallbackInfo.java @@ -24,7 +24,7 @@ import org.apache.cassandra.service.StorageProxy; /** * Encapsulates the callback information. - * The ability to set the message is useful in cases for when a hint needs + * The ability to set the message is useful in cases for when a hint needs * to be written due to a timeout in the response from a replica. */ class CallbackInfo diff --git a/src/java/org/apache/cassandra/net/CompactEndpointSerializationHelper.java b/src/java/org/apache/cassandra/net/CompactEndpointSerializationHelper.java index 6c1995b390..3c331d632d 100644 --- a/src/java/org/apache/cassandra/net/CompactEndpointSerializationHelper.java +++ b/src/java/org/apache/cassandra/net/CompactEndpointSerializationHelper.java @@ -31,9 +31,9 @@ public class CompactEndpointSerializationHelper dos.writeByte(buf.length); dos.write(buf); } - + public static InetAddress deserialize(DataInput dis) throws IOException - { + { byte[] bytes = new byte[dis.readByte()]; dis.readFully(bytes, 0, bytes.length); return InetAddress.getByAddress(bytes); diff --git a/src/java/org/apache/cassandra/net/Header.java b/src/java/org/apache/cassandra/net/Header.java index f07a7f6cea..8a18398c27 100644 --- a/src/java/org/apache/cassandra/net/Header.java +++ b/src/java/org/apache/cassandra/net/Header.java @@ -37,9 +37,9 @@ public class Header static { - serializer_ = new HeaderSerializer(); + serializer_ = new HeaderSerializer(); } - + public static IVersionedSerializer
serializer() { return serializer_; @@ -76,7 +76,7 @@ public class Header { return verb_; } - + byte[] getDetail(String key) { return details_.get(key); @@ -117,7 +117,7 @@ public class Header class HeaderSerializer implements IVersionedSerializer
{ public void serialize(Header t, DataOutput dos, int version) throws IOException - { + { CompactEndpointSerializationHelper.serialize(t.getFrom(), dos); dos.writeInt(t.getVerb().ordinal()); dos.writeInt(t.details_.size()); diff --git a/src/java/org/apache/cassandra/net/HeaderTypes.java b/src/java/org/apache/cassandra/net/HeaderTypes.java index 9a6b7ae30d..3cc5c18cf3 100644 --- a/src/java/org/apache/cassandra/net/HeaderTypes.java +++ b/src/java/org/apache/cassandra/net/HeaderTypes.java @@ -18,7 +18,7 @@ package org.apache.cassandra.net; -public class HeaderTypes +public class HeaderTypes { public final static String TASK_PROFILE_CHAIN = "TASK_PROFILE_CHAIN"; public static String TASK_ID = "TASK_ID"; diff --git a/src/java/org/apache/cassandra/net/IAsyncResult.java b/src/java/org/apache/cassandra/net/IAsyncResult.java index b60ba2bfd6..d20ac24c6d 100644 --- a/src/java/org/apache/cassandra/net/IAsyncResult.java +++ b/src/java/org/apache/cassandra/net/IAsyncResult.java @@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; public interface IAsyncResult extends IMessageCallback -{ +{ /** * Same operation as the above get() but allows the calling * thread to specify a timeout. @@ -32,7 +32,7 @@ public interface IAsyncResult extends IMessageCallback * @return the result wrapped in an Object[] */ public byte[] get(long timeout, TimeUnit tu) throws TimeoutException; - + /** * Store the result obtained for the submitted task. * @param result the response message diff --git a/src/java/org/apache/cassandra/net/IMessageCallback.java b/src/java/org/apache/cassandra/net/IMessageCallback.java index d9c57eff17..3ae2a22c1d 100644 --- a/src/java/org/apache/cassandra/net/IMessageCallback.java +++ b/src/java/org/apache/cassandra/net/IMessageCallback.java @@ -1,6 +1,6 @@ package org.apache.cassandra.net; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.net; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java index ee44a1c443..2a617f2f4a 100644 --- a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java +++ b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java @@ -1,6 +1,6 @@ package org.apache.cassandra.net; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.net; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -40,7 +40,7 @@ public class IncomingTcpConnection extends Thread private static Logger logger = LoggerFactory.getLogger(IncomingTcpConnection.class); private static final int CHUNK_SIZE = 1024 * 1024; - + private Socket socket; public InetAddress from; @@ -79,7 +79,7 @@ public class IncomingTcpConnection extends Thread byte[] headerBytes = new byte[size]; input.readFully(headerBytes); stream(StreamHeader.serializer().deserialize(new DataInputStream(new FastByteArrayInputStream(headerBytes)), version), input); - } + } else { // streaming connections are per-session and have a fixed version. we can't do anything with a wrong-version stream connection, so drop it. @@ -89,7 +89,7 @@ public class IncomingTcpConnection extends Thread // We are done with this connection.... return; } - + // we should buffer input = new DataInputStream(new BufferedInputStream(socket.getInputStream(), 4096)); // Receive the first message to set the version. @@ -105,7 +105,7 @@ public class IncomingTcpConnection extends Thread Gossiper.instance.setVersion(msg.getFrom(), version); logger.debug("set version for {} to {}", from, version); } - + // loop to get the next message. while (true) { @@ -117,12 +117,12 @@ public class IncomingTcpConnection extends Thread logger.trace("Version is now {}", version); receiveMessage(input, version); } - } + } catch (EOFException e) { logger.trace("eof reading from socket; closing", e); // connection will be reset so no need to throw an exception. - } + } catch (IOException e) { logger.debug("IOError reading from socket; closing", e); diff --git a/src/java/org/apache/cassandra/net/Message.java b/src/java/org/apache/cassandra/net/Message.java index eb743d1cfd..5765f4cde9 100644 --- a/src/java/org/apache/cassandra/net/Message.java +++ b/src/java/org/apache/cassandra/net/Message.java @@ -39,22 +39,22 @@ public class Message body_ = body; this.version = version; } - + public Message(InetAddress from, StorageService.Verb verb, byte[] body, int version) { this(new Header(from, verb), body, version); - } - + } + public byte[] getHeader(String key) { return header_.getDetail(key); } - + public Message withHeaderAdded(String key, byte[] value) { return new Message(header_.withDetailsAdded(key, value), body_, version); } - + public Message withHeaderRemoved(String key) { return new Message(header_.withDetailsRemoved(key), body_, version); @@ -64,7 +64,7 @@ public class Message { return body_; } - + public int getVersion() { return version; diff --git a/src/java/org/apache/cassandra/net/MessageProducer.java b/src/java/org/apache/cassandra/net/MessageProducer.java index 4c9bba5a55..14d652ee55 100644 --- a/src/java/org/apache/cassandra/net/MessageProducer.java +++ b/src/java/org/apache/cassandra/net/MessageProducer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.net; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.net; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java index b0e7de93a3..b92b0e4f04 100644 --- a/src/java/org/apache/cassandra/net/MessagingService.java +++ b/src/java/org/apache/cassandra/net/MessagingService.java @@ -264,7 +264,7 @@ public final class MessagingService implements MessagingServiceMBean // setReuseAddress happens in the factory. logger_.info("Starting Encrypted Messaging Service on SSL port {}", DatabaseDescriptor.getSSLStoragePort()); } - + ServerSocketChannel serverChannel = ServerSocketChannel.open(); ServerSocket socket = serverChannel.socket(); socket.setReuseAddress(true); @@ -343,7 +343,7 @@ public final class MessagingService implements MessagingServiceMBean { return addCallback(cb, message, to, DEFAULT_CALLBACK_TIMEOUT); } - + public String addCallback(IMessageCallback cb, Message message, InetAddress to, long timeout) { String messageId = nextId(); diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java index f9d866d221..e826fe34d8 100644 --- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java +++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java @@ -1,6 +1,6 @@ package org.apache.cassandra.net; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.net; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -53,7 +53,7 @@ public class OutboundTcpConnection extends Thread private volatile BlockingQueue backlog = new LinkedBlockingQueue(); private volatile BlockingQueue active = new LinkedBlockingQueue(); - private final OutboundTcpConnectionPool poolReference; + private final OutboundTcpConnectionPool poolReference; private DataOutputStream out; private Socket socket; diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java index ed820b643f..641767ad59 100644 --- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java +++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java @@ -65,14 +65,14 @@ public class OutboundTcpConnectionPool for (OutboundTcpConnection con : new OutboundTcpConnection[] { cmdCon, ackCon }) con.closeSocket(); } - + public void reset(InetAddress remoteEP) { resetedEndpoint = remoteEP; for (OutboundTcpConnection con : new OutboundTcpConnection[] { cmdCon, ackCon }) con.softCloseSocket(); } - + public Socket newSocket() throws IOException { // zero means 'bind on any available port.' @@ -91,12 +91,12 @@ public class OutboundTcpConnectionPool return new Socket(endPoint(), DatabaseDescriptor.getStoragePort(), FBUtilities.getLocalAddress(), 0); } } - + InetAddress endPoint() { return resetedEndpoint == null ? id : resetedEndpoint; } - + boolean isEncryptedChannel() { switch (DatabaseDescriptor.getEncryptionOptions().internode_encryption) diff --git a/src/java/org/apache/cassandra/net/ResponseVerbHandler.java b/src/java/org/apache/cassandra/net/ResponseVerbHandler.java index 818f703d9f..b997985a0b 100644 --- a/src/java/org/apache/cassandra/net/ResponseVerbHandler.java +++ b/src/java/org/apache/cassandra/net/ResponseVerbHandler.java @@ -26,7 +26,7 @@ public class ResponseVerbHandler implements IVerbHandler private static final Logger logger_ = LoggerFactory.getLogger( ResponseVerbHandler.class ); public void doVerb(Message message, String id) - { + { double age = System.currentTimeMillis() - MessagingService.instance().getRegisteredCallbackAge(id); CallbackInfo callbackInfo = MessagingService.instance().removeRegisteredCallback(id); if (callbackInfo == null) diff --git a/src/java/org/apache/cassandra/notifications/INotification.java b/src/java/org/apache/cassandra/notifications/INotification.java index f37bf1c096..934f62b071 100644 --- a/src/java/org/apache/cassandra/notifications/INotification.java +++ b/src/java/org/apache/cassandra/notifications/INotification.java @@ -1,6 +1,6 @@ package org.apache.cassandra.notifications; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.notifications; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/notifications/INotificationConsumer.java b/src/java/org/apache/cassandra/notifications/INotificationConsumer.java index 7d5dcb6db2..3c4e0945d4 100644 --- a/src/java/org/apache/cassandra/notifications/INotificationConsumer.java +++ b/src/java/org/apache/cassandra/notifications/INotificationConsumer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.notifications; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.notifications; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/notifications/SSTableAddedNotification.java b/src/java/org/apache/cassandra/notifications/SSTableAddedNotification.java index 7705d0c8dd..0773f6ca95 100644 --- a/src/java/org/apache/cassandra/notifications/SSTableAddedNotification.java +++ b/src/java/org/apache/cassandra/notifications/SSTableAddedNotification.java @@ -1,6 +1,6 @@ package org.apache.cassandra.notifications; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.notifications; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/notifications/SSTableListChangedNotification.java b/src/java/org/apache/cassandra/notifications/SSTableListChangedNotification.java index 480dcf2a4b..12c086575a 100644 --- a/src/java/org/apache/cassandra/notifications/SSTableListChangedNotification.java +++ b/src/java/org/apache/cassandra/notifications/SSTableListChangedNotification.java @@ -1,6 +1,6 @@ package org.apache.cassandra.notifications; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.notifications; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/scheduler/IRequestScheduler.java b/src/java/org/apache/cassandra/scheduler/IRequestScheduler.java index 8f89bd0d13..5026c8d5e5 100644 --- a/src/java/org/apache/cassandra/scheduler/IRequestScheduler.java +++ b/src/java/org/apache/cassandra/scheduler/IRequestScheduler.java @@ -1,6 +1,6 @@ package org.apache.cassandra.scheduler; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.scheduler; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.concurrent.TimeoutException; @@ -29,7 +29,7 @@ public interface IRequestScheduler { /** * Queue incoming request threads - * + * * @param t Thread handing the request * @param id Scheduling parameter, an id to distinguish profiles (users/keyspace) * @param timeoutMS The max time in milliseconds to spend blocking for a slot diff --git a/src/java/org/apache/cassandra/scheduler/NoScheduler.java b/src/java/org/apache/cassandra/scheduler/NoScheduler.java index 7150e1fa46..75c6027f5b 100644 --- a/src/java/org/apache/cassandra/scheduler/NoScheduler.java +++ b/src/java/org/apache/cassandra/scheduler/NoScheduler.java @@ -3,7 +3,7 @@ package org.apache.cassandra.scheduler; import org.apache.cassandra.config.RequestSchedulerOptions; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -11,21 +11,21 @@ import org.apache.cassandra.config.RequestSchedulerOptions; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ /** * This is basically not having a scheduler, the requests are - * processed as normally would be handled by the JVM. + * processed as normally would be handled by the JVM. */ public class NoScheduler implements IRequestScheduler { diff --git a/src/java/org/apache/cassandra/scheduler/RoundRobinScheduler.java b/src/java/org/apache/cassandra/scheduler/RoundRobinScheduler.java index 38e9b2788e..47d21570b7 100644 --- a/src/java/org/apache/cassandra/scheduler/RoundRobinScheduler.java +++ b/src/java/org/apache/cassandra/scheduler/RoundRobinScheduler.java @@ -1,7 +1,7 @@ package org.apache.cassandra.scheduler; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.scheduler; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.Map; @@ -32,8 +32,8 @@ import org.apache.cassandra.config.RequestSchedulerOptions; import org.cliffc.high_scale_lib.NonBlockingHashMap; /** - * A very basic Round Robin implementation of the RequestScheduler. It handles - * request groups identified on user/keyspace by placing them in separate + * A very basic Round Robin implementation of the RequestScheduler. It handles + * request groups identified on user/keyspace by placing them in separate * queues and servicing a request from each queue in a RoundRobin fashion. * It optionally adds weights for each round. */ @@ -134,7 +134,7 @@ public class RoundRobinScheduler implements IRequestScheduler } /* - * Get the Queue for the respective id, if one is not available + * Get the Queue for the respective id, if one is not available * create a new queue for that corresponding id and return it */ private WeightedQueue getWeightedQueue(String id) diff --git a/src/java/org/apache/cassandra/scheduler/WeightedQueue.java b/src/java/org/apache/cassandra/scheduler/WeightedQueue.java index d65f709201..d37b9231bb 100644 --- a/src/java/org/apache/cassandra/scheduler/WeightedQueue.java +++ b/src/java/org/apache/cassandra/scheduler/WeightedQueue.java @@ -1,7 +1,7 @@ package org.apache.cassandra.scheduler; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.scheduler; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.concurrent.SynchronousQueue; diff --git a/src/java/org/apache/cassandra/scheduler/WeightedQueueMBean.java b/src/java/org/apache/cassandra/scheduler/WeightedQueueMBean.java index 6b1c7f252a..1e9aa0928e 100644 --- a/src/java/org/apache/cassandra/scheduler/WeightedQueueMBean.java +++ b/src/java/org/apache/cassandra/scheduler/WeightedQueueMBean.java @@ -1,6 +1,6 @@ package org.apache.cassandra.scheduler; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.scheduler; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ /** diff --git a/src/java/org/apache/cassandra/security/SSLFactory.java b/src/java/org/apache/cassandra/security/SSLFactory.java index 794f7d9d42..b1fa060bd8 100644 --- a/src/java/org/apache/cassandra/security/SSLFactory.java +++ b/src/java/org/apache/cassandra/security/SSLFactory.java @@ -126,7 +126,7 @@ public final class SSLFactory } return ctx; } - + private static String[] filterCipherSuites(String[] supported, String[] desired) { Set des = Sets.newHashSet(desired); diff --git a/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java b/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java index f124f9f828..9f19123f19 100644 --- a/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java +++ b/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java @@ -53,7 +53,7 @@ import org.apache.cassandra.utils.Mx4jTool; * service, which defines not only a way to activate and deactivate it, but also * hooks into its lifecycle methods (see {@link #setup()}, {@link #start()}, * {@link #stop()} and {@link #setup()}). - * + * */ public abstract class AbstractCassandraDaemon implements CassandraDaemon { @@ -76,7 +76,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon // then try loading from the classpath. configLocation = AbstractCassandraDaemon.class.getClassLoader().getResource(config); } - + if (configLocation == null) throw new RuntimeException("Couldn't figure out log4j configuration: "+config); @@ -104,11 +104,11 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon private static Logger logger = LoggerFactory.getLogger(AbstractCassandraDaemon.class); static final AtomicInteger exceptions = new AtomicInteger(); - + protected InetAddress listenAddr; protected int listenPort; protected volatile boolean isRunning = false; - + /** * This is a hook for concrete daemons to initialize themselves suitably. * @@ -175,7 +175,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon logger.error("Fatal exception during initialization", e); System.exit(100); } - + // load keyspace descriptions. try { @@ -186,7 +186,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon logger.error("Fatal exception during initialization", e); System.exit(100); } - + // clean up debris in the rest of the tables for (String table : Schema.instance.getTables()) { @@ -244,7 +244,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon * Initialize the Cassandra Daemon based on the given Commons * Daemon-specific arguments. To clarify, this is a hook for JSVC. - * + * * @param arguments * the arguments passed in from JSVC * @throws IOException @@ -253,7 +253,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon { setup(); } - + /** * Start the Cassandra Daemon, assuming that it has already been * initialized via {@link #init(String[])} @@ -273,7 +273,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon logger.info("Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) to start it"); } } - + /** * Stop the daemon, ideally in an idempotent manner. * @@ -333,42 +333,42 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon */ protected abstract void stopServer(); - + /** * Clean up all resources obtained during the lifetime of the daemon. This * is a hook for JSVC. */ public void destroy() {} - + /** * A convenience method to initialize and start the daemon in one shot. */ public void activate() { String pidFile = System.getProperty("cassandra-pidfile"); - + try { setup(); - + if (pidFile != null) { new File(pidFile).deleteOnExit(); } - + if (System.getProperty("cassandra-foreground") == null) { System.out.close(); System.err.close(); } - + start(); } catch (Throwable e) { logger.error("Exception encountered during startup", e); - + // try to warn user on stdout too, if we haven't already detached e.printStackTrace(); System.out.println("Exception encountered during startup: " + e.getMessage()); @@ -376,7 +376,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon System.exit(3); } } - + /** * A convenience method to stop and destroy the daemon in one shot. */ @@ -385,7 +385,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon stop(); destroy(); } - + /** * A subclass of Java's ThreadPoolExecutor which implements Jetty's ThreadPool * interface (for integration with Avro), and performs ClientState cleanup. @@ -393,7 +393,7 @@ public abstract class AbstractCassandraDaemon implements CassandraDaemon * (Note that the tasks being executed perform their own while-command-process * loop until the client disconnects.) */ - public static class CleaningThreadPool extends ThreadPoolExecutor + public static class CleaningThreadPool extends ThreadPoolExecutor { private ThreadLocal state; public CleaningThreadPool(ThreadLocal state, int minWorkerThread, int maxWorkerThreads) diff --git a/src/java/org/apache/cassandra/service/AbstractRowResolver.java b/src/java/org/apache/cassandra/service/AbstractRowResolver.java index 85cd573537..b4e78ff438 100644 --- a/src/java/org/apache/cassandra/service/AbstractRowResolver.java +++ b/src/java/org/apache/cassandra/service/AbstractRowResolver.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java b/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java index 0a21676196..5c446a194f 100644 --- a/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/AbstractWriteResponseHandler.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/AntiEntropyService.java b/src/java/org/apache/cassandra/service/AntiEntropyService.java index 812c23a1db..5979860a80 100644 --- a/src/java/org/apache/cassandra/service/AntiEntropyService.java +++ b/src/java/org/apache/cassandra/service/AntiEntropyService.java @@ -260,7 +260,7 @@ public class AntiEntropyService private transient DecoratedKey lastKey; public final static MerkleTree.RowHash EMPTY_ROW = new MerkleTree.RowHash(null, new byte[0]); - + Validator(TreeRequest request) { this(request, @@ -452,9 +452,9 @@ public class AntiEntropyService * Trigger a validation compaction which will return the tree upon completion. */ public void doVerb(Message message, String id) - { + { byte[] bytes = message.getMessageBody(); - + DataInputStream buffer = new DataInputStream(new FastByteArrayInputStream(bytes)); try { @@ -469,7 +469,7 @@ public class AntiEntropyService } catch (IOException e) { - throw new IOError(e); + throw new IOError(e); } } } @@ -488,9 +488,9 @@ public class AntiEntropyService FastByteArrayOutputStream bos = new FastByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); SERIALIZER.serialize(validator, dos, Gossiper.instance.getVersion(validator.request.endpoint)); - return new Message(local, - StorageService.Verb.TREE_RESPONSE, - bos.toByteArray(), + return new Message(local, + StorageService.Verb.TREE_RESPONSE, + bos.toByteArray(), Gossiper.instance.getVersion(validator.request.endpoint)); } catch(IOException e) @@ -520,7 +520,7 @@ public class AntiEntropyService } public void doVerb(Message message, String id) - { + { byte[] bytes = message.getMessageBody(); DataInputStream buffer = new DataInputStream(new FastByteArrayInputStream(bytes)); @@ -573,7 +573,7 @@ public class AntiEntropyService { return Objects.hashCode(sessionid, endpoint, cf, range); } - + @Override public final boolean equals(Object o) { @@ -583,7 +583,7 @@ public class AntiEntropyService // handles nulls properly return Objects.equal(sessionid, that.sessionid) && Objects.equal(endpoint, that.endpoint) && Objects.equal(cf, that.cf) && Objects.equal(range, that.range); } - + @Override public String toString() { diff --git a/src/java/org/apache/cassandra/service/AsyncRepairCallback.java b/src/java/org/apache/cassandra/service/AsyncRepairCallback.java index 72a4b0929b..b8f46e2b74 100644 --- a/src/java/org/apache/cassandra/service/AsyncRepairCallback.java +++ b/src/java/org/apache/cassandra/service/AsyncRepairCallback.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java index bb67a5a692..026b9319e3 100644 --- a/src/java/org/apache/cassandra/service/CassandraDaemon.java +++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -26,7 +26,7 @@ import java.io.IOException; /** * The CassandraDaemon interface captures the lifecycle of a * Cassandra daemon that runs on a single node. - * + * */ public interface CassandraDaemon { @@ -34,26 +34,26 @@ public interface CassandraDaemon * Initialize the Cassandra Daemon based on the given Commons * Daemon-specific arguments. To clarify, this is a hook for JSVC. - * + * * @param arguments * the arguments passed in from JSVC * @throws IOException */ public void init(String[] arguments) throws IOException; - + /** * Start the Cassandra Daemon, assuming that it has already been * initialized (via {@link CassandraDaemon#init(String[])}) - * + * * @throws IOException */ public void start() throws IOException; - + /** * Stop the daemon, ideally in an idempotent manner. */ public void stop(); - + /** * Clean up all resources obtained during the lifetime of the daemon. Just * to clarify, this is a hook for JSVC. @@ -63,15 +63,15 @@ public interface CassandraDaemon public void startRPCServer(); public void stopRPCServer(); public boolean isRPCServerRunning(); - + /** * A convenience method to initialize and start the daemon in one shot. */ public void activate(); - + /** * A convenience method to stop and destroy the daemon in one shot. */ public void deactivate(); - + } diff --git a/src/java/org/apache/cassandra/service/ClientState.java b/src/java/org/apache/cassandra/service/ClientState.java index 603e51a2fe..3b88a3f80e 100644 --- a/src/java/org/apache/cassandra/service/ClientState.java +++ b/src/java/org/apache/cassandra/service/ClientState.java @@ -159,7 +159,7 @@ public class ClientState hasAccess(user, perms, perm, resource); } - + /** * Confirms that the client thread has the given Permission for the ColumnFamily list of * the current keyspace. @@ -176,10 +176,10 @@ public class ClientState resourceClear(); resource.add(keyspace); Set perms = DatabaseDescriptor.getAuthority().authorize(user, resource); - + hasAccess(user, perms, perm, resource); } - + /** * Confirms that the client thread has the given Permission in the context of the given * ColumnFamily and the current keyspace. @@ -193,12 +193,12 @@ public class ClientState { validateLogin(); validateKeyspace(); - + resourceClear(); resource.add(keyspace); resource.add(columnFamily); Set perms = DatabaseDescriptor.getAuthority().authorize(user, resource); - + hasAccess(user, perms, perm, resource); } @@ -207,7 +207,7 @@ public class ClientState if (user == null) throw new InvalidRequestException("You have not logged in"); } - + private void validateKeyspace() throws InvalidRequestException { if (keyspace == null) diff --git a/src/java/org/apache/cassandra/service/DatacenterReadCallback.java b/src/java/org/apache/cassandra/service/DatacenterReadCallback.java index 00540ca156..83225b82fe 100644 --- a/src/java/org/apache/cassandra/service/DatacenterReadCallback.java +++ b/src/java/org/apache/cassandra/service/DatacenterReadCallback.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -78,7 +78,7 @@ public class DatacenterReadCallback extends ReadCallback // version of this method gets called return true; } - + @Override public int determineBlockFor(ConsistencyLevel consistency_level, String table) { diff --git a/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java b/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java index 50453a0e86..a3f682531b 100644 --- a/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java @@ -3,7 +3,7 @@ */ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -11,16 +11,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java b/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java index 7ca3dd188c..62385db124 100644 --- a/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java @@ -3,7 +3,7 @@ */ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -11,16 +11,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -78,7 +78,7 @@ public class DatacenterWriteResponseHandler extends WriteResponseHandler condition.signal(); } } - + @Override public void assureSufficientLiveNodes() throws UnavailableException { diff --git a/src/java/org/apache/cassandra/service/EmbeddedCassandraService.java b/src/java/org/apache/cassandra/service/EmbeddedCassandraService.java index 59a2ffe46b..78cdd01be4 100644 --- a/src/java/org/apache/cassandra/service/EmbeddedCassandraService.java +++ b/src/java/org/apache/cassandra/service/EmbeddedCassandraService.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/GCInspector.java b/src/java/org/apache/cassandra/service/GCInspector.java index 94da3c9f4f..32c2342f54 100644 --- a/src/java/org/apache/cassandra/service/GCInspector.java +++ b/src/java/org/apache/cassandra/service/GCInspector.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.lang.management.GarbageCollectorMXBean; @@ -44,7 +44,7 @@ public class GCInspector final static long INTERVAL_IN_MS = 1000; final static long MIN_DURATION = 200; final static long MIN_DURATION_TPSTATS = 1000; - + public static final GCInspector instance = new GCInspector(); private HashMap gctimes = new HashMap(); @@ -77,7 +77,7 @@ public class GCInspector { // don't bother starting a thread that will do nothing. if (beans.size() == 0) - return; + return; Runnable t = new Runnable() { public void run() @@ -103,12 +103,12 @@ public class GCInspector Long previousCount = gccounts.get(gc.getName()); Long count = gc.getCollectionCount(); - + if (previousCount == null) - previousCount = 0L; + previousCount = 0L; if (count.equals(previousCount)) continue; - + gccounts.put(gc.getName(), count); MemoryUsage mu = membean.getHeapMemoryUsage(); diff --git a/src/java/org/apache/cassandra/service/IReadCommand.java b/src/java/org/apache/cassandra/service/IReadCommand.java index 0a8bd4d3bb..ccc8b28897 100644 --- a/src/java/org/apache/cassandra/service/IReadCommand.java +++ b/src/java/org/apache/cassandra/service/IReadCommand.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/RepairCallback.java b/src/java/org/apache/cassandra/service/RepairCallback.java index 264881a17c..ee123e104e 100644 --- a/src/java/org/apache/cassandra/service/RepairCallback.java +++ b/src/java/org/apache/cassandra/service/RepairCallback.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/SocketSessionManagementService.java b/src/java/org/apache/cassandra/service/SocketSessionManagementService.java index daebf2e0ee..02147a8198 100644 --- a/src/java/org/apache/cassandra/service/SocketSessionManagementService.java +++ b/src/java/org/apache/cassandra/service/SocketSessionManagementService.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 72cdd1b759..8ae8ff8471 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -133,7 +133,7 @@ public class StorageProxy implements StorageProxyMBean Collection targets, IWriteResponseHandler responseHandler, String localDataCenter, - ConsistencyLevel consistency_level) + ConsistencyLevel consistency_level) throws IOException { if (logger.isDebugEnabled()) @@ -271,14 +271,14 @@ public class StorageProxy implements StorageProxyMBean * Note about hints: * * | Hinted Handoff | Consist. Level | - * | on | >=1 | --> wait for hints. We DO NOT notify the handler with handler.response() for hints; + * | on | >=1 | --> wait for hints. We DO NOT notify the handler with handler.response() for hints; * | on | ANY | --> wait for hints. Responses count towards consistency. * | off | >=1 | --> DO NOT fire hints. And DO NOT wait for them to complete. * | off | ANY | --> DO NOT fire hints. And DO NOT wait for them to complete. * - * @throws TimeoutException if the hints cannot be written/enqueued + * @throws TimeoutException if the hints cannot be written/enqueued */ - public static void sendToHintedEndpoints(final RowMutation rm, + public static void sendToHintedEndpoints(final RowMutation rm, Collection targets, IWriteResponseHandler responseHandler, String localDataCenter, @@ -545,7 +545,7 @@ public class StorageProxy implements StorageProxyMBean return performWrite(cm, cm.consistency(), localDataCenter, counterWriteOnCoordinatorPerformer); } - private static Runnable counterWriteTask(final IMutation mutation, + private static Runnable counterWriteTask(final IMutation mutation, final Collection targets, final IWriteResponseHandler responseHandler, final String localDataCenter, @@ -947,8 +947,8 @@ public class StorageProxy implements StorageProxyMBean for (InetAddress endpoint : liveHosts) { Message message = new Message(FBUtilities.getBroadcastAddress(), - StorageService.Verb.SCHEMA_CHECK, - ArrayUtils.EMPTY_BYTE_ARRAY, + StorageService.Verb.SCHEMA_CHECK, + ArrayUtils.EMPTY_BYTE_ARRAY, Gossiper.instance.getVersion(endpoint)); MessagingService.instance().sendRR(message, endpoint, cb); } @@ -1148,7 +1148,7 @@ public class StorageProxy implements StorageProxyMBean { if (!hintedHandoffEnabled) return false; - + boolean hintWindowExpired = Gossiper.instance.getEndpointDowntime(ep) > maxHintWindow; if (hintWindowExpired) logger.debug("not hinting {} which has been down {}ms", ep, Gossiper.instance.getEndpointDowntime(ep)); diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 91ea705e80..4d4953102e 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -947,7 +947,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe return Lists.newArrayList(); } }); - + List> ranges = getAllRanges(tokenMetadata_.sortedTokens()); for (Range range : ranges) { @@ -2638,20 +2638,20 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe } public Map effectiveOwnership(String keyspace) throws ConfigurationException - { + { Map effective = Maps.newHashMap(); if (Schema.instance.getNonSystemTables().size() <= 0) throw new ConfigurationException("Couldn't find any Non System Keyspaces to infer replication topology"); if (keyspace == null && !hasSameReplication(Schema.instance.getNonSystemTables())) throw new ConfigurationException("Non System keyspaces doesnt have the same topology"); - + if (keyspace == null) keyspace = Schema.instance.getNonSystemTables().get(0); - + List sortedTokens = new ArrayList(tokenMetadata_.getTokenToEndpointMapForReading().keySet()); Collections.sort(sortedTokens); Map ownership = getPartitioner().describeOwnership(sortedTokens); - + for (Entry>> ranges : constructEndpointToRangeMap(keyspace).entrySet()) { Token token = tokenMetadata_.getToken(ranges.getKey()); @@ -2663,7 +2663,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe } return effective; } - + private boolean hasSameReplication(List list) { if (list.isEmpty()) @@ -2672,8 +2672,8 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe { KSMetaData ksm1 = Schema.instance.getKSMetaData(Schema.instance.getNonSystemTables().get(i)); KSMetaData ksm2 = Schema.instance.getKSMetaData(Schema.instance.getNonSystemTables().get(i + 1)); - if (!ksm1.strategyClass.equals(ksm2.strategyClass) || - !Iterators.elementsEqual(ksm1.strategyOptions.entrySet().iterator(), + if (!ksm1.strategyClass.equals(ksm2.strategyClass) || + !Iterators.elementsEqual(ksm1.strategyOptions.entrySet().iterator(), ksm2.strategyOptions.entrySet().iterator())) return false; } @@ -2755,7 +2755,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe latch.countDown(); continue; } - + final String table = entry.getKey(); final Set, InetAddress>> pending = new HashSet, InetAddress>>(rangesWithEndpoints.entries()); @@ -2968,7 +2968,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe sampledKeys.add(key.getToken().toString()); return sampledKeys; } - + public void rebuildSecondaryIndex(String ksName, String cfName, String... idxNames) { ColumnFamilyStore.rebuildSecondaryIndex(ksName, cfName, idxNames); diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/java/org/apache/cassandra/service/StorageServiceMBean.java index a3cbc7b0f5..afff793e94 100644 --- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java +++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java @@ -300,7 +300,7 @@ public interface StorageServiceMBean public Map getOwnership(); /** - * Effective ownership is % of the data each node owns given the keyspace + * Effective ownership is % of the data each node owns given the keyspace * we calculate the percentage using replication factor. * If Keyspace == null, this method will try to verify if all the keyspaces * in the cluster have the same replication strategies and if yes then we will @@ -344,7 +344,7 @@ public interface StorageServiceMBean public boolean isJoined(); public int getExceptionCount(); - + public void setStreamThroughputMbPerSec(int value); public int getStreamThroughputMbPerSec(); @@ -378,7 +378,7 @@ public interface StorageServiceMBean /** * Return a List of Tokens representing a sample of keys * across all ColumnFamilyStores - * + * * @return set of Tokens as Strings */ public List getRangeKeySample(); diff --git a/src/java/org/apache/cassandra/streaming/FileStreamTask.java b/src/java/org/apache/cassandra/streaming/FileStreamTask.java index 948bea77b9..7c84c03968 100644 --- a/src/java/org/apache/cassandra/streaming/FileStreamTask.java +++ b/src/java/org/apache/cassandra/streaming/FileStreamTask.java @@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory; public class FileStreamTask extends WrappedRunnable { private static Logger logger = LoggerFactory.getLogger(FileStreamTask.class); - + public static final int CHUNK_SIZE = 64 * 1024; // around 10 minutes at the default rpctimeout public static final int MAX_CONNECT_ATTEMPTS = 8; @@ -85,7 +85,7 @@ public class FileStreamTask extends WrappedRunnable } }); } - + public void runMayThrow() throws IOException { try diff --git a/src/java/org/apache/cassandra/streaming/PendingFile.java b/src/java/org/apache/cassandra/streaming/PendingFile.java index 50e09216c1..5701ae88df 100644 --- a/src/java/org/apache/cassandra/streaming/PendingFile.java +++ b/src/java/org/apache/cassandra/streaming/PendingFile.java @@ -1,6 +1,6 @@ package org.apache.cassandra.streaming; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.streaming; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -63,7 +63,7 @@ public class PendingFile { this(sstable, desc, component, sections, type, 0); } - + public PendingFile(SSTableReader sstable, Descriptor desc, String component, List> sections, OperationType type, long estimatedKeys) { this.sstable = sstable; @@ -86,7 +86,7 @@ public class PendingFile { return desc.filenameFor(component); } - + public boolean equals(Object o) { if ( !(o instanceof PendingFile) ) @@ -134,14 +134,14 @@ public class PendingFile String filename = dis.readUTF(); if (filename.isEmpty()) return null; - + Descriptor desc = Descriptor.fromFilename(filename); String component = dis.readUTF(); int count = dis.readInt(); List> sections = new ArrayList>(count); for (int i = 0; i < count; i++) sections.add(new Pair(Long.valueOf(dis.readLong()), Long.valueOf(dis.readLong()))); - // this controls the way indexes are rebuilt when streaming in. + // this controls the way indexes are rebuilt when streaming in. OperationType type = OperationType.RESTORE_REPLICA_COUNT; if (version > MessagingService.VERSION_07) type = OperationType.valueOf(dis.readUTF()); diff --git a/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java b/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java index 4fe784537b..b161f34dde 100644 --- a/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java +++ b/src/java/org/apache/cassandra/streaming/ReplicationFinishedVerbHandler.java @@ -1,6 +1,6 @@ package org.apache.cassandra.streaming; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.streaming; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import org.apache.commons.lang.ArrayUtils; diff --git a/src/java/org/apache/cassandra/streaming/StreamHeader.java b/src/java/org/apache/cassandra/streaming/StreamHeader.java index 97161e8a96..793e19ef49 100644 --- a/src/java/org/apache/cassandra/streaming/StreamHeader.java +++ b/src/java/org/apache/cassandra/streaming/StreamHeader.java @@ -70,7 +70,7 @@ public class StreamHeader { this(table, sessionId, first, pendingFiles, FBUtilities.getBroadcastAddress()); } - + public StreamHeader(String table, long sessionId, PendingFile first, Collection pendingFiles, InetAddress broadcastAddress) { this.table = table; diff --git a/src/java/org/apache/cassandra/streaming/StreamIn.java b/src/java/org/apache/cassandra/streaming/StreamIn.java index 75a23a22bf..93bdc08db0 100644 --- a/src/java/org/apache/cassandra/streaming/StreamIn.java +++ b/src/java/org/apache/cassandra/streaming/StreamIn.java @@ -1,6 +1,6 @@ package org.apache.cassandra.streaming; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.streaming; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/streaming/StreamOut.java b/src/java/org/apache/cassandra/streaming/StreamOut.java index 517bc0e3bd..710c9ed17f 100644 --- a/src/java/org/apache/cassandra/streaming/StreamOut.java +++ b/src/java/org/apache/cassandra/streaming/StreamOut.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/streaming/StreamOutSession.java b/src/java/org/apache/cassandra/streaming/StreamOutSession.java index ea5ccda12b..80629b8fe6 100644 --- a/src/java/org/apache/cassandra/streaming/StreamOutSession.java +++ b/src/java/org/apache/cassandra/streaming/StreamOutSession.java @@ -93,7 +93,7 @@ public class StreamOutSession implements IEndpointStateChangeSubscriber, IFailur { return context.right; } - + public void addFilesToStream(List pendingFiles) { for (PendingFile pendingFile : pendingFiles) @@ -103,7 +103,7 @@ public class StreamOutSession implements IEndpointStateChangeSubscriber, IFailur files.put(pendingFile.getFilename(), pendingFile); } } - + public void retry() { streamFile(files.get(currentFile)); diff --git a/src/java/org/apache/cassandra/streaming/StreamReply.java b/src/java/org/apache/cassandra/streaming/StreamReply.java index 6ba79b3819..f97cfee3ef 100644 --- a/src/java/org/apache/cassandra/streaming/StreamReply.java +++ b/src/java/org/apache/cassandra/streaming/StreamReply.java @@ -1,6 +1,6 @@ package org.apache.cassandra.streaming; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.streaming; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/streaming/StreamRequestMessage.java b/src/java/org/apache/cassandra/streaming/StreamRequestMessage.java index c5179ba398..27f7b6c6a4 100644 --- a/src/java/org/apache/cassandra/streaming/StreamRequestMessage.java +++ b/src/java/org/apache/cassandra/streaming/StreamRequestMessage.java @@ -1,6 +1,6 @@ package org.apache.cassandra.streaming; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.streaming; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -45,7 +45,7 @@ import org.apache.cassandra.utils.FBUtilities; * This class encapsulates the message that needs to be sent to nodes * that handoff data. The message contains information about ranges * that need to be transferred and the target node. -* +* * If a file is specified, ranges and table will not. vice-versa should hold as well. */ class StreamRequestMessage implements MessageProducer @@ -63,10 +63,10 @@ class StreamRequestMessage implements MessageProducer protected final long sessionId; protected final InetAddress target; - + // if this is specified, ranges and table should not be. protected final PendingFile file; - + // if these are specified, file shoud not be. protected final Collection> ranges; protected final String table; @@ -94,7 +94,7 @@ class StreamRequestMessage implements MessageProducer table = null; columnFamilies = null; } - + public Message getMessage(Integer version) { FastByteArrayOutputStream bos = new FastByteArrayOutputStream(); diff --git a/src/java/org/apache/cassandra/streaming/StreamRequestVerbHandler.java b/src/java/org/apache/cassandra/streaming/StreamRequestVerbHandler.java index b2b6f282cb..a328be1ce2 100644 --- a/src/java/org/apache/cassandra/streaming/StreamRequestVerbHandler.java +++ b/src/java/org/apache/cassandra/streaming/StreamRequestVerbHandler.java @@ -36,7 +36,7 @@ import org.apache.cassandra.net.Message; public class StreamRequestVerbHandler implements IVerbHandler { private static Logger logger = LoggerFactory.getLogger(StreamRequestVerbHandler.class); - + public void doVerb(Message message, String id) { if (logger.isDebugEnabled()) diff --git a/src/java/org/apache/cassandra/streaming/StreamingService.java b/src/java/org/apache/cassandra/streaming/StreamingService.java index 403958e092..497fa62f8d 100644 --- a/src/java/org/apache/cassandra/streaming/StreamingService.java +++ b/src/java/org/apache/cassandra/streaming/StreamingService.java @@ -86,7 +86,7 @@ public class StreamingService implements StreamingServiceMBean InetAddress dest = InetAddress.getByName(host); if (!existingDestinations.contains(dest)) return files; - + for (PendingFile f : StreamOutSession.getOutgoingFiles(dest)) files.add(String.format("%s", f.toString())); return files; diff --git a/src/java/org/apache/cassandra/streaming/StreamingServiceMBean.java b/src/java/org/apache/cassandra/streaming/StreamingServiceMBean.java index 1ea82e00a0..661019320f 100644 --- a/src/java/org/apache/cassandra/streaming/StreamingServiceMBean.java +++ b/src/java/org/apache/cassandra/streaming/StreamingServiceMBean.java @@ -36,7 +36,7 @@ public interface StreamingServiceMBean /** details about incoming streams */ public List getIncomingFiles(String host) throws IOException; - + /** What's currently happening wrt streaming. */ public String getStatus(); } diff --git a/src/java/org/apache/cassandra/thrift/CassandraDaemon.java b/src/java/org/apache/cassandra/thrift/CassandraDaemon.java index e05389bb9d..52473a6287 100644 --- a/src/java/org/apache/cassandra/thrift/CassandraDaemon.java +++ b/src/java/org/apache/cassandra/thrift/CassandraDaemon.java @@ -45,10 +45,10 @@ import org.apache.thrift.transport.TTransportException; import org.apache.thrift.transport.TTransportFactory; /** - * This class supports two methods for creating a Cassandra node daemon, - * invoking the class's main method, and using the jsvc wrapper from - * commons-daemon, (for more information on using this class with the - * jsvc wrapper, see the + * This class supports two methods for creating a Cassandra node daemon, + * invoking the class's main method, and using the jsvc wrapper from + * commons-daemon, (for more information on using this class with the + * jsvc wrapper, see the * Commons Daemon * documentation). */ @@ -132,17 +132,17 @@ public class CassandraDaemon extends org.apache.cassandra.service.AbstractCassan TTransportFactory inTransportFactory = new TFramedTransport.Factory(tFramedTransportSize); TTransportFactory outTransportFactory = new TFramedTransport.Factory(tFramedTransportSize); logger.info("Using TFastFramedTransport with a max frame size of {} bytes.", tFramedTransportSize); - + if (DatabaseDescriptor.getRpcServerType().equalsIgnoreCase(SYNC)) - { + { TServerTransport serverTransport; try { - serverTransport = new TCustomServerSocket(new InetSocketAddress(listenAddr, listenPort), - DatabaseDescriptor.getRpcKeepAlive(), + serverTransport = new TCustomServerSocket(new InetSocketAddress(listenAddr, listenPort), + DatabaseDescriptor.getRpcKeepAlive(), DatabaseDescriptor.getRpcSendBufferSize(), DatabaseDescriptor.getRpcRecvBufferSize()); - } + } catch (TTransportException e) { throw new RuntimeException(String.format("Unable to create thrift socket to %s:%s", listenAddr, listenPort), e); @@ -166,10 +166,10 @@ public class CassandraDaemon extends org.apache.cassandra.service.AbstractCassan try { serverTransport = new TCustomNonblockingServerSocket(new InetSocketAddress(listenAddr, listenPort), - DatabaseDescriptor.getRpcKeepAlive(), + DatabaseDescriptor.getRpcKeepAlive(), DatabaseDescriptor.getRpcSendBufferSize(), DatabaseDescriptor.getRpcRecvBufferSize()); - } + } catch (TTransportException e) { throw new RuntimeException(String.format("Unable to create thrift socket to %s:%s", listenAddr, listenPort), e); @@ -186,15 +186,15 @@ public class CassandraDaemon extends org.apache.cassandra.service.AbstractCassan .processor(processor); logger.info(String.format("Using non-blocking/asynchronous thrift server on %s : %s", listenAddr, listenPort)); serverEngine = new CustomTNonBlockingServer(serverArgs); - } + } else if (DatabaseDescriptor.getRpcServerType().equalsIgnoreCase(HSHA)) { // This is NIO selector service but the invocation will be Multi-Threaded with the Executor service. ExecutorService executorService = new JMXEnabledThreadPoolExecutor(DatabaseDescriptor.getRpcMinThreads(), DatabaseDescriptor.getRpcMaxThreads(), - 60L, + 60L, TimeUnit.SECONDS, - new SynchronousQueue(), + new SynchronousQueue(), new NamedThreadFactory("RPC-Thread"), "RPC-THREAD-POOL"); TNonblockingServer.Args serverArgs = new TNonblockingServer.Args(serverTransport).inputTransportFactory(inTransportFactory) .outputTransportFactory(outTransportFactory) diff --git a/src/java/org/apache/cassandra/thrift/CassandraServer.java b/src/java/org/apache/cassandra/thrift/CassandraServer.java index 2503315d4e..952a10351f 100644 --- a/src/java/org/apache/cassandra/thrift/CassandraServer.java +++ b/src/java/org/apache/cassandra/thrift/CassandraServer.java @@ -62,7 +62,7 @@ import org.apache.thrift.TException; public class CassandraServer implements Cassandra.Iface { private static Logger logger = LoggerFactory.getLogger(CassandraServer.class); - + private final static int COUNT_PAGE_SIZE = 1024; private final static List EMPTY_COLUMNS = Collections.emptyList(); @@ -88,7 +88,7 @@ public class CassandraServer implements Cassandra.Iface { requestScheduler = DatabaseDescriptor.getRequestScheduler(); } - + public ClientState state() { SocketAddress remoteSocket = SocketSessionManagementService.remoteSocket.get(); @@ -123,7 +123,7 @@ public class CassandraServer implements Cassandra.Iface release(); } } - catch (TimeoutException e) + catch (TimeoutException e) { logger.debug("... timed out"); throw new TimedOutException(); @@ -312,12 +312,12 @@ public class CassandraServer implements Cassandra.Iface throws InvalidRequestException, UnavailableException, TimedOutException { logger.debug("get_slice"); - + ClientState cState = state(); cState.hasColumnFamilyAccess(column_parent.column_family, Permission.READ); return multigetSliceInternal(cState.getKeyspace(), Collections.singletonList(key), column_parent, predicate, consistency_level).get(key); } - + public Map> multiget_slice(List keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException { @@ -612,7 +612,7 @@ public class CassandraServer implements Cassandra.Iface ThriftValidation.validateCommutativeForWrite(metadata, consistency_level); RowMutation rm = new RowMutation(cState.getKeyspace(), key); - rm.delete(new QueryPath(column_path), timestamp); + rm.delete(new QueryPath(column_path), timestamp); if (isCommutativeOp) doInsert(consistency_level, Arrays.asList(new CounterMutation(rm, consistency_level))); @@ -910,8 +910,8 @@ public class CassandraServer implements Cassandra.Iface { requestScheduler.release(); } - - // helper method to apply migration on the migration stage. typical migration failures will throw an + + // helper method to apply migration on the migration stage. typical migration failures will throw an // InvalidRequestException. atypical failures will throw a RuntimeException. private static void applyMigrationOnStage(final Migration m) { @@ -953,11 +953,11 @@ public class CassandraServer implements Cassandra.Iface throws InvalidRequestException, SchemaDisagreementException, TException { logger.debug("drop_column_family"); - + ClientState cState = state(); cState.hasColumnFamilySchemaAccess(Permission.WRITE); validateSchemaAgreement(); - + try { applyMigrationOnStage(new DropColumnFamily(cState.getKeyspace(), column_family)); @@ -981,7 +981,7 @@ public class CassandraServer implements Cassandra.Iface ThriftValidation.validateKeyspaceNotYetExisting(ks_def.name); // generate a meaningful error if the user setup keyspace and/or column definition incorrectly - for (CfDef cf : ks_def.cf_defs) + for (CfDef cf : ks_def.cf_defs) { if (!cf.getKeyspace().equals(ks_def.getName())) { @@ -1019,7 +1019,7 @@ public class CassandraServer implements Cassandra.Iface ThriftValidation.validateKeyspaceNotSystem(keyspace); state().hasKeyspaceSchemaAccess(Permission.WRITE); validateSchemaAgreement(); - + try { applyMigrationOnStage(new DropKeyspace(keyspace)); @@ -1033,7 +1033,7 @@ public class CassandraServer implements Cassandra.Iface } } - /** update an existing keyspace, but do not allow column family modifications. + /** update an existing keyspace, but do not allow column family modifications. * @throws SchemaDisagreementException */ public synchronized String system_update_keyspace(KsDef ks_def) @@ -1137,7 +1137,7 @@ public class CassandraServer implements Cassandra.Iface public Map> describe_schema_versions() throws TException, InvalidRequestException { - logger.debug("checking schema agreement"); + logger.debug("checking schema agreement"); return StorageProxy.describeSchemaVersions(); } @@ -1182,11 +1182,11 @@ public class CassandraServer implements Cassandra.Iface internal_remove(key, path, System.currentTimeMillis(), consistency_level, true); } - + private static String uncompress(ByteBuffer query, Compression compression) throws InvalidRequestException { String queryString = null; - + // Decompress the query string. try { @@ -1195,9 +1195,9 @@ public class CassandraServer implements Cassandra.Iface case GZIP: FastByteArrayOutputStream byteArray = new FastByteArrayOutputStream(); byte[] outBuffer = new byte[1024], inBuffer = new byte[1024]; - + Inflater decompressor = new Inflater(); - + int lenRead = 0; while (true) { @@ -1205,25 +1205,25 @@ public class CassandraServer implements Cassandra.Iface lenRead = query.remaining() < 1024 ? query.remaining() : 1024; query.get(inBuffer, 0, lenRead); decompressor.setInput(inBuffer, 0, lenRead); - + int lenWrite = 0; while ((lenWrite = decompressor.inflate(outBuffer)) !=0) byteArray.write(outBuffer, 0, lenWrite); - + if (decompressor.finished()) break; } - + decompressor.end(); - + queryString = new String(byteArray.toByteArray(), 0, byteArray.size(), "UTF-8"); break; case NONE: - try + try { queryString = ByteBufferUtil.string(query); } - catch (CharacterCodingException ex) + catch (CharacterCodingException ex) { throw new InvalidRequestException(ex.getMessage()); } @@ -1245,9 +1245,9 @@ public class CassandraServer implements Cassandra.Iface throws InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException { if (logger.isDebugEnabled()) logger.debug("execute_cql_query"); - + String queryString = uncompress(query,compression); - + try { ClientState cState = state(); @@ -1268,9 +1268,9 @@ public class CassandraServer implements Cassandra.Iface throws InvalidRequestException, TException { if (logger.isDebugEnabled()) logger.debug("prepare_cql_query"); - + String queryString = uncompress(query,compression); - + try { ClientState cState = state(); diff --git a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java index 9bfb4f7ae2..9f7b0cf6fa 100644 --- a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java +++ b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; /** * This is a interim solution till THRIFT-1167 gets committed... - * + * * The idea here is to avoid sticking to one CPU for IO's. For better throughput * it is spread across multiple threads. Number of selector thread can be the * number of CPU available. @@ -125,7 +125,7 @@ public class CustomTHsHaServer extends TNonblockingServer // wait till all done with stuff's for (SelectorThread thread : ioThreads) thread.join(); - } + } catch (InterruptedException e) { LOGGER.error("Interrupted while joining threads!", e); @@ -162,7 +162,7 @@ public class CustomTHsHaServer extends TNonblockingServer this.selector = SelectorProvider.provider().openSelector(); this.serverTransport = (TNonblockingServerTransport) serverTransport_; this.serverTransport.registerSelector(selector); - } + } catch (IOException ex) { throw new RuntimeException("Couldnt open the NIO selector", ex); @@ -185,7 +185,7 @@ public class CustomTHsHaServer extends TNonblockingServer { // ignore this exception. } - } + } catch (Throwable t) { LOGGER.error("Uncaught Exception: ", t); @@ -220,7 +220,7 @@ public class CustomTHsHaServer extends TNonblockingServer // process the changes which are inserted after completion. processInterestChanges(); } - + private void handleAccept() { SelectionKey clientKey = null; @@ -232,7 +232,7 @@ public class CustomTHsHaServer extends TNonblockingServer clientKey = client.registerSelector(selector, SelectionKey.OP_READ); // add this key to the map FrameBuffer frameBuffer = new FrameBuffer(client, clientKey); - clientKey.attach(frameBuffer); + clientKey.attach(frameBuffer); } catch (TTransportException ex) { // ignore this might have been handled by the other threads. @@ -250,7 +250,7 @@ public class CustomTHsHaServer extends TNonblockingServer client.close(); } } - + private void handleRead(SelectionKey key) { FrameBuffer buffer = (FrameBuffer) key.attachment(); @@ -266,14 +266,14 @@ public class CustomTHsHaServer extends TNonblockingServer cleanupSelectionkey(key); } } - + private void handleWrite(SelectionKey key) { FrameBuffer buffer = (FrameBuffer) key.attachment(); if (!buffer.write()) cleanupSelectionkey(key); } - + public void requestSelectInterestChange(FrameBuffer frameBuffer) { synchronized (selectInterestChanges) @@ -293,7 +293,7 @@ public class CustomTHsHaServer extends TNonblockingServer selectInterestChanges.clear(); } } - + private void cleanupSelectionkey(SelectionKey key) { FrameBuffer buffer = (FrameBuffer) key.attachment(); @@ -302,13 +302,13 @@ public class CustomTHsHaServer extends TNonblockingServer // cancel the selection key key.cancel(); } - + public void wakeupSelector() { selector.wakeup(); } } - + protected boolean requestInvoke(FrameBuffer frameBuffer, SelectorThread thread) { try @@ -316,7 +316,7 @@ public class CustomTHsHaServer extends TNonblockingServer Runnable invocation = new Invocation(frameBuffer, thread); invoker.execute(invocation); return true; - } + } catch (RejectedExecutionException rx) { LOGGER.warn("ExecutorService rejected execution!", rx); diff --git a/src/java/org/apache/cassandra/thrift/CustomTNonBlockingServer.java b/src/java/org/apache/cassandra/thrift/CustomTNonBlockingServer.java index b25fc0d837..0b6c90b1d2 100644 --- a/src/java/org/apache/cassandra/thrift/CustomTNonBlockingServer.java +++ b/src/java/org/apache/cassandra/thrift/CustomTNonBlockingServer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/thrift/CustomTThreadPoolServer.java b/src/java/org/apache/cassandra/thrift/CustomTThreadPoolServer.java index 161ff121aa..81377f75e4 100644 --- a/src/java/org/apache/cassandra/thrift/CustomTThreadPoolServer.java +++ b/src/java/org/apache/cassandra/thrift/CustomTThreadPoolServer.java @@ -60,14 +60,14 @@ public class CustomTThreadPoolServer extends TServer //Track and Limit the number of connected clients private final AtomicInteger activeClients = new AtomicInteger(0); - - + + public CustomTThreadPoolServer(TThreadPoolServer.Args args, ExecutorService executorService) { super(args); executorService_ = executorService; this.args = args; } - + public void serve() { try diff --git a/src/java/org/apache/cassandra/thrift/RequestType.java b/src/java/org/apache/cassandra/thrift/RequestType.java index fc09642988..620cfdd3ef 100644 --- a/src/java/org/apache/cassandra/thrift/RequestType.java +++ b/src/java/org/apache/cassandra/thrift/RequestType.java @@ -1,6 +1,6 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/thrift/TCustomNonblockingServerSocket.java b/src/java/org/apache/cassandra/thrift/TCustomNonblockingServerSocket.java index 081c221df7..04cb3add2d 100644 --- a/src/java/org/apache/cassandra/thrift/TCustomNonblockingServerSocket.java +++ b/src/java/org/apache/cassandra/thrift/TCustomNonblockingServerSocket.java @@ -1,6 +1,6 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -63,7 +63,7 @@ public class TCustomNonblockingServerSocket extends TNonblockingServerSocket { logger.warn("Failed to set keep-alive on Thrift socket.", se); } - + if (this.sendBufferSize != null) { try diff --git a/src/java/org/apache/cassandra/thrift/TCustomServerSocket.java b/src/java/org/apache/cassandra/thrift/TCustomServerSocket.java index 3be5e56589..e139190ef9 100644 --- a/src/java/org/apache/cassandra/thrift/TCustomServerSocket.java +++ b/src/java/org/apache/cassandra/thrift/TCustomServerSocket.java @@ -1,7 +1,7 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.IOException; @@ -54,7 +54,7 @@ public class TCustomServerSocket extends TServerTransport /** * Allows fine-tuning of the server socket including keep-alive, reuse of addresses, send and receive buffer sizes. - * + * * @param bindAddr * @param keepAlive * @param sendBufferSize diff --git a/src/java/org/apache/cassandra/thrift/TCustomSocket.java b/src/java/org/apache/cassandra/thrift/TCustomSocket.java index 90e571362d..edae2cc457 100644 --- a/src/java/org/apache/cassandra/thrift/TCustomSocket.java +++ b/src/java/org/apache/cassandra/thrift/TCustomSocket.java @@ -18,7 +18,7 @@ */ package org.apache.cassandra.thrift; - + import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; @@ -30,37 +30,37 @@ import org.apache.thrift.transport.TIOStreamTransport; import org.apache.thrift.transport.TTransportException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - + /** - * Socket implementation of the TTransport interface. - * + * Socket implementation of the TTransport interface. + * * Adds socket buffering * */ public class TCustomSocket extends TIOStreamTransport { - + private static final Logger LOGGER = LoggerFactory.getLogger(TCustomSocket.class.getName()); - + /** * Wrapped Socket object */ private Socket socket_ = null; - + /** * Remote host */ private String host_ = null; - + /** * Remote port */ private int port_ = 0; - + /** * Socket timeout */ private int timeout_ = 0; - + /** * Constructor that takes an already created socket. * @@ -75,7 +75,7 @@ public class TCustomSocket extends TIOStreamTransport { } catch (SocketException sx) { LOGGER.warn("Could not configure socket.", sx); } - + if (isOpen()) { try { inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024); @@ -86,7 +86,7 @@ public class TCustomSocket extends TIOStreamTransport { } } } - + /** * Creates a new unconnected socket that will connect to the given host * on the given port. @@ -97,7 +97,7 @@ public class TCustomSocket extends TIOStreamTransport { public TCustomSocket(String host, int port) { this(host, port, 0); } - + /** * Creates a new unconnected socket that will connect to the given host * on the given port. @@ -112,7 +112,7 @@ public class TCustomSocket extends TIOStreamTransport { timeout_ = timeout; initSocket(); } - + /** * Initializes the socket object */ @@ -126,7 +126,7 @@ public class TCustomSocket extends TIOStreamTransport { LOGGER.error("Could not configure socket.", sx); } } - + /** * Sets the socket timeout * @@ -140,7 +140,7 @@ public class TCustomSocket extends TIOStreamTransport { LOGGER.warn("Could not set socket timeout.", sx); } } - + /** * Returns a reference to the underlying socket. */ @@ -150,7 +150,7 @@ public class TCustomSocket extends TIOStreamTransport { } return socket_; } - + /** * Checks whether the socket is connected. */ @@ -160,7 +160,7 @@ public class TCustomSocket extends TIOStreamTransport { } return socket_.isConnected(); } - + /** * Connects the socket, creating a new socket object if necessary. */ @@ -168,18 +168,18 @@ public class TCustomSocket extends TIOStreamTransport { if (isOpen()) { throw new TTransportException(TTransportException.ALREADY_OPEN, "Socket already connected."); } - + if (host_.length() == 0) { throw new TTransportException(TTransportException.NOT_OPEN, "Cannot open null host."); } if (port_ <= 0) { throw new TTransportException(TTransportException.NOT_OPEN, "Cannot open without port."); } - + if (socket_ == null) { initSocket(); } - + try { socket_.connect(new InetSocketAddress(host_, port_), timeout_); inputStream_ = new BufferedInputStream(socket_.getInputStream(), 1024); @@ -189,14 +189,14 @@ public class TCustomSocket extends TIOStreamTransport { throw new TTransportException(TTransportException.NOT_OPEN, iox); } } - + /** * Closes the socket. */ public void close() { // Close the underlying streams super.close(); - + // Close the socket if (socket_ != null) { try { @@ -207,5 +207,5 @@ public class TCustomSocket extends TIOStreamTransport { socket_ = null; } } - + } \ No newline at end of file diff --git a/src/java/org/apache/cassandra/thrift/ThriftValidation.java b/src/java/org/apache/cassandra/thrift/ThriftValidation.java index e996ce345e..ff833df270 100644 --- a/src/java/org/apache/cassandra/thrift/ThriftValidation.java +++ b/src/java/org/apache/cassandra/thrift/ThriftValidation.java @@ -1,6 +1,6 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.nio.ByteBuffer; @@ -678,16 +678,16 @@ public class ThriftValidation if (!oldCd.getIndexName().equals(c.index_name)) throw new InvalidRequestException("Cannot modify index name"); } - + if (c.index_type == IndexType.CUSTOM) { if (c.index_options == null || !c.index_options.containsKey(SecondaryIndex.CUSTOM_INDEX_OPTION_NAME)) - throw new InvalidRequestException("Required index option missing: " + SecondaryIndex.CUSTOM_INDEX_OPTION_NAME); + throw new InvalidRequestException("Required index option missing: " + SecondaryIndex.CUSTOM_INDEX_OPTION_NAME); } - + // Create the index type and validate the options ColumnDefinition cdef = ColumnDefinition.fromThrift(c); - + // This method validates the column metadata but does not intialize the index SecondaryIndex.createInstance(null, cdef); } diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java index 04324f26c6..84618be212 100644 --- a/src/java/org/apache/cassandra/tools/NodeCmd.java +++ b/src/java/org/apache/cassandra/tools/NodeCmd.java @@ -1,6 +1,6 @@ package org.apache.cassandra.tools; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.tools; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -60,7 +60,7 @@ public class NodeCmd private static ToolOptions options = null; private NodeProbe probe; - + static { options = new ToolOptions(); @@ -72,7 +72,7 @@ public class NodeCmd options.addOption(TAG_OPT, true, "optional name to give a snapshot"); options.addOption(PRIMARY_RANGE_OPT, false, "only repair the first range returned by the partitioner for the node"); } - + public NodeCmd(NodeProbe probe) { this.probe = probe; @@ -124,7 +124,7 @@ public class NodeCmd RESETLOCALSCHEMA } - + /** * Prints usage information to stdout. */ @@ -199,10 +199,10 @@ public class NodeCmd for (int i = cmd.length(); i < 22; ++i) sb.append(" "); sb.append(" - ").append(description).append("\n"); } - + /** * Write a textual representation of the Cassandra ring. - * + * * @param outs the stream to write to */ public void printRing(PrintStream outs, String keyspace) @@ -218,7 +218,7 @@ public class NodeCmd Map loadMap = probe.getLoadMap(); String format = "%-16s%-12s%-12s%-7s%-8s%-16s%-20s%-44s%n"; - + // Calculate per-token ownership of the ring Map ownerships; try @@ -232,7 +232,7 @@ public class NodeCmd outs.printf("Note: Ownership information does not include topology, please specify a keyspace. \n"); outs.printf(format, "Address", "DC", "Rack", "Status", "State", "Load", "Owns", "Token"); } - + // show pre-wrap token twice so you can always read a node's range as // (previous line token, current line token] if (sortedTokens.size() > 1) @@ -308,7 +308,7 @@ public class NodeCmd /** * Write node information. - * + * * @param outs the stream to write to */ public void printInfo(PrintStream outs) @@ -532,7 +532,7 @@ public class NodeCmd outs.println("\t\tSSTable count: " + cfstore.getLiveSSTableCount()); outs.println("\t\tSpace used (live): " + cfstore.getLiveDiskSpaceUsed()); outs.println("\t\tSpace used (total): " + cfstore.getTotalDiskSpaceUsed()); - outs.println("\t\tNumber of Keys (estimate): " + cfstore.estimateKeys()); + outs.println("\t\tNumber of Keys (estimate): " + cfstore.estimateKeys()); outs.println("\t\tMemtable Columns Count: " + cfstore.getMemtableColumnsCount()); outs.println("\t\tMemtable Data Size: " + cfstore.getMemtableDataSize()); outs.println("\t\tMemtable Switch Count: " + cfstore.getMemtableSwitchCount()); @@ -553,7 +553,7 @@ public class NodeCmd outs.println("----------------"); } } - + public void printRemovalStatus(PrintStream outs) { outs.println("RemovalStatus: " + probe.getRemovalStatus()); @@ -621,7 +621,7 @@ public class NodeCmd String host = cmd.hasOption(HOST_OPT.left) ? cmd.getOptionValue(HOST_OPT.left) : DEFAULT_HOST; int port = DEFAULT_PORT; - + String portNum = cmd.getOptionValue(PORT_OPT.left); if (portNum != null) { @@ -637,7 +637,7 @@ public class NodeCmd String username = cmd.getOptionValue(USERNAME_OPT.left); String password = cmd.getOptionValue(PASSWORD_OPT.left); - + NodeProbe probe = null; try { @@ -668,7 +668,7 @@ public class NodeCmd switch (command) { - case RING : + case RING : if (arguments.length > 0) { nodeCmd.printRing(System.out, arguments[0]); } else { nodeCmd.printRing(System.out, null); }; break; @@ -685,7 +685,7 @@ public class NodeCmd case ENABLETHRIFT : probe.startThriftServer(); break; case STATUSTHRIFT : nodeCmd.printIsThriftServerRunning(System.out); break; case RESETLOCALSCHEMA: probe.resetLocalSchema(); break; - + case DRAIN : try { probe.drain(); } catch (ExecutionException ee) { err(ee, "Error occured during flushing"); } @@ -797,7 +797,7 @@ public class NodeCmd probe.rebuildIndex(arguments[0], arguments[1], arguments[2].split(",")); else probe.rebuildIndex(arguments[0], arguments[1]); - + break; case GOSSIPINFO : nodeCmd.printGossipInfo(System.out); break; @@ -862,7 +862,7 @@ public class NodeCmd outs.println("\t" + tokenString); } } - + private void printGossipInfo(PrintStream out) { out.println(probe.getGossipInfo()); } @@ -880,7 +880,7 @@ public class NodeCmd e.printStackTrace(); System.exit(3); } - + private static void complainNonzeroArgs(String[] args, NodeCommand cmd) { if (args.length > 0) { @@ -893,18 +893,18 @@ public class NodeCmd private static void handleSnapshots(NodeCommand nc, String tag, String[] cmdArgs, NodeProbe probe) throws InterruptedException, IOException { String[] keyspaces = Arrays.copyOfRange(cmdArgs, 0, cmdArgs.length); - System.out.print("Requested snapshot for: "); - if ( keyspaces.length > 0 ) + System.out.print("Requested snapshot for: "); + if ( keyspaces.length > 0 ) { - for (int i = 0; i < keyspaces.length; i++) - System.out.print(keyspaces[i] + " "); - } - else + for (int i = 0; i < keyspaces.length; i++) + System.out.print(keyspaces[i] + " "); + } + else { System.out.print("all keyspaces"); } System.out.println(); - + switch (nc) { case SNAPSHOT : diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java index fc0c21ce07..b0d9019493 100644 --- a/src/java/org/apache/cassandra/tools/NodeProbe.java +++ b/src/java/org/apache/cassandra/tools/NodeProbe.java @@ -104,7 +104,7 @@ public class NodeProbe /** * Creates a NodeProbe using the specified JMX host and port. - * + * * @param host hostname or IP address of the JMX agent * @param port TCP port of the remote JMX agent * @throws IOException on connection failures @@ -115,10 +115,10 @@ public class NodeProbe this.port = port; connect(); } - + /** * Creates a NodeProbe using the specified JMX host and default port. - * + * * @param host hostname or IP address of the JMX agent * @throws IOException on connection failures */ @@ -128,10 +128,10 @@ public class NodeProbe this.port = defaultPort; connect(); } - + /** * Create a connection to the JMX agent and setup the M[X]Bean proxies. - * + * * @throws IOException on connection failures */ private void connect() throws IOException @@ -145,7 +145,7 @@ public class NodeProbe } jmxc = JMXConnectorFactory.connect(jmxUrl, env); mbeanServerConn = jmxc.getMBeanServerConnection(); - + try { ObjectName name = new ObjectName(ssObjName); @@ -165,8 +165,8 @@ public class NodeProbe throw new RuntimeException( "Invalid ObjectName? Please report this as a bug.", e); } - - memProxy = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConn, + + memProxy = ManagementFactory.newPlatformMXBeanProxy(mbeanServerConn, ManagementFactory.MEMORY_MXBEAN_NAME, MemoryMXBean.class); runtimeProxy = ManagementFactory.newPlatformMXBeanProxy( mbeanServerConn, ManagementFactory.RUNTIME_MXBEAN_NAME, RuntimeMXBean.class); @@ -224,9 +224,9 @@ public class NodeProbe public void drain() throws IOException, InterruptedException, ExecutionException { - ssProxy.drain(); + ssProxy.drain(); } - + public Map getTokenToEndpointMap() { return ssProxy.getTokenToEndpointMap(); @@ -256,7 +256,7 @@ public class NodeProbe { return ssProxy.getUnreachableNodes(); } - + public Map getLoadMap() { return ssProxy.getLoadMap(); @@ -311,7 +311,7 @@ public class NodeProbe { return ssProxy.getToken(); } - + public String getLoadString() { return ssProxy.getLoadString(); @@ -326,20 +326,20 @@ public class NodeProbe { return ssProxy.getCurrentGenerationNumber(); } - + public long getUptime() { return runtimeProxy.getUptime(); } - + public MemoryUsage getHeapMemoryUsage() { return memProxy.getHeapMemoryUsage(); } - + /** * Take a snapshot of all the tables. - * + * * @param snapshotName the name of the snapshot. */ public void takeSnapshot(String snapshotName, String... keyspaces) throws IOException @@ -389,7 +389,7 @@ public class NodeProbe { ssProxy.forceRemoveCompletion(); } - + public Iterator> getThreadPoolMBeanProxies() { try @@ -508,14 +508,14 @@ public class NodeProbe throw new RuntimeException(e); } } - + public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf) { ColumnFamilyStoreMBean cfsProxy = null; try { cfsProxy = JMX.newMBeanProxy(mbeanServerConn, - new ObjectName("org.apache.cassandra.db:type=ColumnFamilies,keyspace="+ks+",columnfamily="+cf), + new ObjectName("org.apache.cassandra.db:type=ColumnFamilies,keyspace="+ks+",columnfamily="+cf), ColumnFamilyStoreMBean.class); } catch (MalformedObjectNameException mone) @@ -669,7 +669,7 @@ class ColumnFamilyStoreMBeanIterator implements Iterator resIter; private MBeanServerConnection mbeanServerConn; - + public ColumnFamilyStoreMBeanIterator(MBeanServerConnection mbeanServerConn) throws MalformedObjectNameException, NullPointerException, IOException { @@ -701,8 +701,8 @@ class ThreadPoolProxyMBeanIterator implements Iterator resIter; private MBeanServerConnection mbeanServerConn; - - public ThreadPoolProxyMBeanIterator(MBeanServerConnection mbeanServerConn) + + public ThreadPoolProxyMBeanIterator(MBeanServerConnection mbeanServerConn) throws MalformedObjectNameException, NullPointerException, IOException { Set requests = mbeanServerConn.queryNames(new ObjectName("org.apache.cassandra.request:type=*"), null); @@ -710,7 +710,7 @@ class ThreadPoolProxyMBeanIterator implements Iterator [-k key [-k key [...]] -x key [-x key [...]]]%n", SSTableExport.class.getName()); - + CommandLineParser parser = new PosixParser(); try { @@ -386,7 +386,7 @@ public class SSTableExport System.err.println(usage); System.exit(1); } - + String[] keys = cmd.getOptionValues(KEY_OPTION); String[] excludes = cmd.getOptionValues(EXCLUDEKEY_OPTION); diff --git a/src/java/org/apache/cassandra/tools/SSTableImport.java b/src/java/org/apache/cassandra/tools/SSTableImport.java index 2d97ae58fe..7098c10bc7 100644 --- a/src/java/org/apache/cassandra/tools/SSTableImport.java +++ b/src/java/org/apache/cassandra/tools/SSTableImport.java @@ -176,7 +176,7 @@ public class SSTableImport /** * Add columns to a column family. - * + * * @param row the columns associated with a row * @param superName name of the super column if any * @param cfamily the column family to add columns to @@ -209,10 +209,10 @@ public class SSTableImport } } } - + /** * Add super columns to a column family. - * + * * @param row the super columns associated with a row * @param cfamily the column family to add columns to */ @@ -239,7 +239,7 @@ public class SSTableImport /** * Convert a JSON formatted file to an SSTable. - * + * * @param jsonFile the file containing JSON formatted data * @param keyspace keyspace the data belongs to * @param cf column family the data belongs to @@ -424,7 +424,7 @@ public class SSTableImport /** * Converts JSON to an SSTable file. JSON input can either be a file specified * using an optional command line argument, or supplied on standard in. - * + * * @param args command line arguments * @throws IOException on failure to open/read/write files or output streams * @throws ParseException on failure to parse JSON input diff --git a/src/java/org/apache/cassandra/utils/Allocator.java b/src/java/org/apache/cassandra/utils/Allocator.java index 671111c23d..b0fdd91bf5 100644 --- a/src/java/org/apache/cassandra/utils/Allocator.java +++ b/src/java/org/apache/cassandra/utils/Allocator.java @@ -38,4 +38,4 @@ public abstract class Allocator } public abstract ByteBuffer allocate(int size); -} +} diff --git a/src/java/org/apache/cassandra/utils/BloomFilterSerializer.java b/src/java/org/apache/cassandra/utils/BloomFilterSerializer.java index 7625b16631..a127c52b77 100644 --- a/src/java/org/apache/cassandra/utils/BloomFilterSerializer.java +++ b/src/java/org/apache/cassandra/utils/BloomFilterSerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java index bdf39b5c2d..34a58e00b0 100644 --- a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java +++ b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -36,37 +36,37 @@ import org.apache.commons.lang.ArrayUtils; /** * Utility methods to make ByteBuffers less painful - * The following should illustrate the different ways byte buffers can be used - * + * The following should illustrate the different ways byte buffers can be used + * * public void testArrayOffet() * { - * + * * byte[] b = "test_slice_array".getBytes(); * ByteBuffer bb = ByteBuffer.allocate(1024); - * + * * assert bb.position() == 0; * assert bb.limit() == 1024; * assert bb.capacity() == 1024; - * + * * bb.put(b); - * + * * assert bb.position() == b.length; * assert bb.remaining() == bb.limit() - bb.position(); - * + * * ByteBuffer bb2 = bb.slice(); - * + * * assert bb2.position() == 0; - * + * * //slice should begin at other buffers current position * assert bb2.arrayOffset() == bb.position(); - * - * //to match the position in the underlying array one needs to + * + * //to match the position in the underlying array one needs to * //track arrayOffset * assert bb2.limit()+bb2.arrayOffset() == bb.limit(); - * - * + * + * * assert bb2.remaining() == bb.remaining(); - * + * * } * * } @@ -84,7 +84,7 @@ public class ByteBufferUtil return 0; if (o1.hasArray() && o2.hasArray()) - { + { return FBUtilities.compareUnsigned(o1.array(), o2.array(), o1.position() + o1.arrayOffset(), o2.position() + o2.arrayOffset(), o1.remaining(), o2.remaining()); } @@ -100,7 +100,7 @@ public class ByteBufferUtil } return o1.remaining() - o2.remaining(); } - + public static int compare(byte[] o1, ByteBuffer o2) { return compareUnsigned(ByteBuffer.wrap(o1), o2); @@ -250,10 +250,10 @@ public class ByteBufferUtil public static ByteBuffer clone(ByteBuffer buffer) { assert buffer != null; - + if (buffer.remaining() == 0) return EMPTY_BYTE_BUFFER; - + ByteBuffer clone = ByteBuffer.allocate(buffer.remaining()); if (buffer.hasArray()) @@ -406,7 +406,7 @@ public class ByteBufferUtil { return bytes.getInt(bytes.position()); } - + public static long toLong(ByteBuffer bytes) { return bytes.getLong(bytes.position()); diff --git a/src/java/org/apache/cassandra/utils/BytesReadTracker.java b/src/java/org/apache/cassandra/utils/BytesReadTracker.java index cc9c7b7206..143f5ab5bc 100644 --- a/src/java/org/apache/cassandra/utils/BytesReadTracker.java +++ b/src/java/org/apache/cassandra/utils/BytesReadTracker.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/src/java/org/apache/cassandra/utils/CLibrary.java b/src/java/org/apache/cassandra/utils/CLibrary.java index 0f994033e8..c6fdab395b 100644 --- a/src/java/org/apache/cassandra/utils/CLibrary.java +++ b/src/java/org/apache/cassandra/utils/CLibrary.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -39,7 +39,7 @@ public final class CLibrary private static final int MCL_CURRENT = 1; private static final int MCL_FUTURE = 2; - + private static final int ENOMEM = 12; private static final int F_GETFL = 3; /* get file status flags */ diff --git a/src/java/org/apache/cassandra/utils/CloseableIterator.java b/src/java/org/apache/cassandra/utils/CloseableIterator.java index edbd24834f..208801bd24 100644 --- a/src/java/org/apache/cassandra/utils/CloseableIterator.java +++ b/src/java/org/apache/cassandra/utils/CloseableIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/DefaultDouble.java b/src/java/org/apache/cassandra/utils/DefaultDouble.java index d9ca813c3f..f3278d6104 100644 --- a/src/java/org/apache/cassandra/utils/DefaultDouble.java +++ b/src/java/org/apache/cassandra/utils/DefaultDouble.java @@ -8,9 +8,9 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,23 +23,23 @@ public class DefaultDouble { private final double originalValue; private double currentValue; - + public DefaultDouble(double value) { originalValue = value; currentValue = value; } - - public double value() + + public double value() { return currentValue; } - + public void set(double d) { currentValue = d; } - + public boolean isModified() { return originalValue != currentValue; diff --git a/src/java/org/apache/cassandra/utils/DefaultInteger.java b/src/java/org/apache/cassandra/utils/DefaultInteger.java index ac98e47260..05fd5a380c 100644 --- a/src/java/org/apache/cassandra/utils/DefaultInteger.java +++ b/src/java/org/apache/cassandra/utils/DefaultInteger.java @@ -8,9 +8,9 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,27 +19,27 @@ package org.apache.cassandra.utils; */ -public class DefaultInteger +public class DefaultInteger { private final int originalValue; private int currentValue; - + public DefaultInteger(int value) { originalValue = value; currentValue = value; } - - public int value() + + public int value() { return currentValue; } - + public void set(int i) { currentValue = i; } - + public boolean isModified() { return originalValue != currentValue; diff --git a/src/java/org/apache/cassandra/utils/EstimatedHistogram.java b/src/java/org/apache/cassandra/utils/EstimatedHistogram.java index cdbdcbf6cb..7a3f78af15 100644 --- a/src/java/org/apache/cassandra/utils/EstimatedHistogram.java +++ b/src/java/org/apache/cassandra/utils/EstimatedHistogram.java @@ -188,7 +188,7 @@ public class EstimatedHistogram public long count() { long sum = 0L; - for (int i = 0; i < buckets.length(); i++) + for (int i = 0; i < buckets.length(); i++) sum += buckets.get(i); return sum; } @@ -206,10 +206,10 @@ public class EstimatedHistogram { if (this == o) return true; - + if (!(o instanceof EstimatedHistogram)) return false; - + EstimatedHistogram that = (EstimatedHistogram) o; return Arrays.equals(getBucketOffsets(), that.getBucketOffsets()) && Arrays.equals(getBuckets(false), that.getBuckets(false)); diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java index 7736d4cc1c..91d2c1be48 100644 --- a/src/java/org/apache/cassandra/utils/FBUtilities.java +++ b/src/java/org/apache/cassandra/utils/FBUtilities.java @@ -181,7 +181,7 @@ public class FBUtilities { return FastByteComparisons.compareTo(bytes1, offset1, len1, bytes2, offset2, len2); } - + /** * @return The bitwise XOR of the inputs. The output will be the same length as the * longer input, but if either input is null, the output will be null. @@ -210,7 +210,7 @@ public class FBUtilities { byte[] result = hash(data); BigInteger hash = new BigInteger(result); - return hash.abs(); + return hash.abs(); } public static byte[] hash(ByteBuffer... data) diff --git a/src/java/org/apache/cassandra/utils/FastByteComparisons.java b/src/java/org/apache/cassandra/utils/FastByteComparisons.java index 09ca68fa71..6597c774f6 100644 --- a/src/java/org/apache/cassandra/utils/FastByteComparisons.java +++ b/src/java/org/apache/cassandra/utils/FastByteComparisons.java @@ -62,7 +62,7 @@ abstract class FastByteComparisons { private static class LexicographicalComparerHolder { static final String UNSAFE_COMPARER_NAME = LexicographicalComparerHolder.class.getName() + "$UnsafeComparer"; - + static final Comparer BEST_COMPARER = getBestComparer(); /** * Returns the Unsafe-using Comparer, or falls back to the pure-Java @@ -81,7 +81,7 @@ abstract class FastByteComparisons { return lexicographicalComparerJavaImpl(); } } - + private enum PureJavaComparer implements Comparer { INSTANCE; @@ -106,7 +106,7 @@ abstract class FastByteComparisons { return length1 - length2; } } - + @SuppressWarnings("unused") // used via reflection private enum UnsafeComparer implements Comparer { INSTANCE; diff --git a/src/java/org/apache/cassandra/utils/GuidGenerator.java b/src/java/org/apache/cassandra/utils/GuidGenerator.java index 81cb6206c7..02edb1b397 100644 --- a/src/java/org/apache/cassandra/utils/GuidGenerator.java +++ b/src/java/org/apache/cassandra/utils/GuidGenerator.java @@ -46,7 +46,7 @@ public class GuidGenerator { public static String guid() { ByteBuffer array = guidAsBytes(); - + StringBuilder sb = new StringBuilder(); for (int j = array.position(); j < array.limit(); ++j) { @@ -57,7 +57,7 @@ public class GuidGenerator { return convertToStandardFormat( sb.toString() ); } - + public static String guidToString(byte[] bytes) { StringBuilder sb = new StringBuilder(); @@ -69,7 +69,7 @@ public class GuidGenerator { return convertToStandardFormat( sb.toString() ); } - + public static ByteBuffer guidAsBytes() { StringBuilder sbValueBeforeMD5 = new StringBuilder(); diff --git a/src/java/org/apache/cassandra/utils/Hex.java b/src/java/org/apache/cassandra/utils/Hex.java index 7e61d9a664..b7f3e450b3 100644 --- a/src/java/org/apache/cassandra/utils/Hex.java +++ b/src/java/org/apache/cassandra/utils/Hex.java @@ -23,7 +23,7 @@ public class Hex { private static final Constructor stringConstructor = getProtectedConstructor(String.class, int.class, int.class, char[].class); private final static byte[] charToByte = new byte[256]; - + // package protected for use by ByteBufferUtil. Do not modify this array !! static final char[] byteToChar = new char[16]; static @@ -45,7 +45,7 @@ public class Hex byteToChar[i] = Integer.toHexString(i).charAt(0); } } - + public static byte[] hexToBytes(String str) { if (str.length() % 2 == 1) @@ -75,7 +75,7 @@ public class Hex return wrapCharArray(c); } - + /** * Create a String from a char array with zero-copy (if available), using reflection to access a package-protected constructor of String. * */ @@ -99,7 +99,7 @@ public class Hex } return s == null ? new String(c) : s; } - + /** * Used to get access to protected/private constructor of the specified class * @param klass - name of the class diff --git a/src/java/org/apache/cassandra/utils/IMergeIterator.java b/src/java/org/apache/cassandra/utils/IMergeIterator.java index 805a7e5a98..a06ea67334 100644 --- a/src/java/org/apache/cassandra/utils/IMergeIterator.java +++ b/src/java/org/apache/cassandra/utils/IMergeIterator.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/IntervalTree/Interval.java b/src/java/org/apache/cassandra/utils/IntervalTree/Interval.java index 244adbef9d..1be9415568 100644 --- a/src/java/org/apache/cassandra/utils/IntervalTree/Interval.java +++ b/src/java/org/apache/cassandra/utils/IntervalTree/Interval.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils.IntervalTree; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils.IntervalTree; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/IntervalTree/IntervalNode.java b/src/java/org/apache/cassandra/utils/IntervalTree/IntervalNode.java index 3fc90f42d4..38c4328ace 100644 --- a/src/java/org/apache/cassandra/utils/IntervalTree/IntervalNode.java +++ b/src/java/org/apache/cassandra/utils/IntervalTree/IntervalNode.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils.IntervalTree; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils.IntervalTree; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java b/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java index 313796c815..a01ed53e4c 100644 --- a/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java +++ b/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils.IntervalTree; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils.IntervalTree; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/LatencyTracker.java b/src/java/org/apache/cassandra/utils/LatencyTracker.java index cbca681f59..ef7258d538 100644 --- a/src/java/org/apache/cassandra/utils/LatencyTracker.java +++ b/src/java/org/apache/cassandra/utils/LatencyTracker.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/LegacyBloomFilterSerializer.java b/src/java/org/apache/cassandra/utils/LegacyBloomFilterSerializer.java index 1105614749..310e73593e 100644 --- a/src/java/org/apache/cassandra/utils/LegacyBloomFilterSerializer.java +++ b/src/java/org/apache/cassandra/utils/LegacyBloomFilterSerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/MerkleTree.java b/src/java/org/apache/cassandra/utils/MerkleTree.java index fc71be2440..fc73ef0800 100644 --- a/src/java/org/apache/cassandra/utils/MerkleTree.java +++ b/src/java/org/apache/cassandra/utils/MerkleTree.java @@ -40,12 +40,12 @@ import org.apache.cassandra.net.MessagingService; * full depth of the perfect binary tree: the leaves of this tree are Leaf objects, * which contain the computed values of the nodes that would be below them if * the tree were perfect. - * + * * The hash values of the inner nodes of the MerkleTree are calculated lazily based * on their children when the hash of a range is requested with hash(range). * * Inputs passed to TreeRange.validate should be calculated using a very secure hash, - * because all hashing internal to the tree is accomplished using XOR. + * because all hashing internal to the tree is accomplished using XOR. * * If two MerkleTrees have the same hashdepth, they represent a perfect tree * of the same depth, and can always be compared, regardless of size or splits. @@ -78,7 +78,7 @@ public class MerkleTree implements Serializable private long maxsize; private long size; private Hashable root; - + public static class MerkleTreeSerializer { public void serialize(MerkleTree mt, DataOutputStream dos, int version) throws IOException @@ -230,7 +230,7 @@ public class MerkleTree implements Serializable List diff = new ArrayList(); TreeRange active = new TreeRange(null, ltree.fullRange.left, ltree.fullRange.right, (byte)0, null); - + byte[] lhash = ltree.hash(active); byte[] rhash = rtree.hash(active); @@ -258,7 +258,7 @@ public class MerkleTree implements Serializable TreeRange right = new TreeRange(null, midpoint, active.right, inc(active.depth), null); byte[] lhash; byte[] rhash; - + // see if we should recurse left lhash = ltree.hash(left); rhash = rtree.hash(left); @@ -315,7 +315,7 @@ public class MerkleTree implements Serializable return new TreeRange(this, pleft, pright, depth, hashable); } // else: node. - + Inner node = (Inner)hashable; if (Range.contains(pleft, node.token, t)) // left child contains token @@ -384,7 +384,7 @@ public class MerkleTree implements Serializable return hashable.hash(); } // else: node. - + Inner node = (Inner)hashable; Range leftactive = new Range(active.left, node.token); Range rightactive = new Range(node.token, active.right); @@ -402,7 +402,7 @@ public class MerkleTree implements Serializable node.hash(lhash, rhash); return node.hash(); } // else: one of our children contains the range - + if (leftactive.contains(range)) // left child contains/matches the range return hashHelper(node.lchild, leftactive, range); @@ -435,7 +435,7 @@ public class MerkleTree implements Serializable } return true; } - + private Hashable splitHelper(Hashable hashable, Token pleft, Token pright, byte depth, Token t) throws StopRecursion.TooDeep { if (depth >= hashdepth) @@ -568,7 +568,7 @@ public class MerkleTree implements Serializable tovisit.add(new TreeRange(tree, tree.fullRange.left, tree.fullRange.right, (byte)0, tree.root)); this.tree = tree; } - + /** * Find the next TreeRange. * @@ -608,7 +608,7 @@ public class MerkleTree implements Serializable } return endOfData(); } - + public Iterator iterator() { return this; @@ -628,7 +628,7 @@ public class MerkleTree implements Serializable private Hashable rchild; private static InnerSerializer serializer = new InnerSerializer(); - + /** * Constructs an Inner with the given token and children, and a null hash. */ @@ -695,7 +695,7 @@ public class MerkleTree implements Serializable toString(buff, 1); return buff.toString(); } - + private static class InnerSerializer { public void serialize(Inner inner, DataOutput dos, int version) throws IOException @@ -740,7 +740,7 @@ public class MerkleTree implements Serializable public static final long serialVersionUID = 1L; static final byte IDENT = 1; private static LeafSerializer serializer = new LeafSerializer(); - + /** * Constructs a null hash. */ @@ -763,7 +763,7 @@ public class MerkleTree implements Serializable { buff.append(toString()); } - + @Override public String toString() { @@ -805,17 +805,17 @@ public class MerkleTree implements Serializable public final byte[] hash; public RowHash(Token token, byte[] hash) { - this.token = token; + this.token = token; this.hash = hash; } - + @Override public String toString() { return "#"; } } - + /** * Abstract class containing hashing logic, and containing a single hash field. */ @@ -873,19 +873,19 @@ public class MerkleTree implements Serializable } public abstract void toString(StringBuilder buff, int maxdepth); - + public static String toString(byte[] hash) { if (hash == null) return "null"; return "[" + Hex.bytesToHex(hash) + "]"; } - + private static class HashableSerializer implements IVersionedSerializer { public void serialize(Hashable h, DataOutput dos, int version) throws IOException { - if (h instanceof Inner) + if (h instanceof Inner) { dos.writeByte(Inner.IDENT); Inner.serializer.serialize((Inner)h, dos, version); diff --git a/src/java/org/apache/cassandra/utils/MurmurHash.java b/src/java/org/apache/cassandra/utils/MurmurHash.java index 432cefcbf6..e33e906eb1 100644 --- a/src/java/org/apache/cassandra/utils/MurmurHash.java +++ b/src/java/org/apache/cassandra/utils/MurmurHash.java @@ -23,7 +23,7 @@ import java.nio.ByteBuffer; /** * This is a very fast, non-cryptographic hash suitable for general hash-based * lookup. See http://murmurhash.googlepages.com/ for more details. - * + * *

* The C version of MurmurHash 2.0 found at that site was ported to Java by * Andrzej Bialecki (ab at getopt org). @@ -103,7 +103,7 @@ public class MurmurHash (((long) key.get(offset+i_8+2) & 0xff)<<16) + (((long) key.get(offset+i_8+3) & 0xff)<<24) + (((long) key.get(offset+i_8+4) & 0xff)<<32) + (((long) key.get(offset+i_8+5) & 0xff)<<40) + (((long) key.get(offset+i_8+6) & 0xff)<<48) + (((long) key.get(offset+i_8+7) & 0xff)<<56); - + k64 *= m64; k64 ^= k64 >>> r64; k64 *= m64; diff --git a/src/java/org/apache/cassandra/utils/Mx4jTool.java b/src/java/org/apache/cassandra/utils/Mx4jTool.java index 83a2b74fdc..63cdff8d14 100644 --- a/src/java/org/apache/cassandra/utils/Mx4jTool.java +++ b/src/java/org/apache/cassandra/utils/Mx4jTool.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/Pair.java b/src/java/org/apache/cassandra/utils/Pair.java index 1d7f2d1375..b3b8510ae6 100644 --- a/src/java/org/apache/cassandra/utils/Pair.java +++ b/src/java/org/apache/cassandra/utils/Pair.java @@ -37,7 +37,7 @@ public class Pair int hashCode = 31 + (left == null ? 0 : left.hashCode()); return 31*hashCode + (right == null ? 0 : right.hashCode()); } - + @Override public final boolean equals(Object o) { @@ -47,7 +47,7 @@ public class Pair // handles nulls properly return Objects.equal(left, that.left) && Objects.equal(right, that.right); } - + @Override public String toString() { diff --git a/src/java/org/apache/cassandra/utils/ResourceWatcher.java b/src/java/org/apache/cassandra/utils/ResourceWatcher.java index 41b298c6ba..8a210281c8 100644 --- a/src/java/org/apache/cassandra/utils/ResourceWatcher.java +++ b/src/java/org/apache/cassandra/utils/ResourceWatcher.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -35,7 +35,7 @@ public class ResourceWatcher { StorageService.scheduledTasks.scheduleWithFixedDelay(new WatchedResource(resource, callback), period, period, TimeUnit.MILLISECONDS); } - + public static class WatchedResource implements Runnable { private static Logger logger = LoggerFactory.getLogger(WatchedResource.class); diff --git a/src/java/org/apache/cassandra/utils/SimpleCondition.java b/src/java/org/apache/cassandra/utils/SimpleCondition.java index ad45b4834a..8bb22292ae 100644 --- a/src/java/org/apache/cassandra/utils/SimpleCondition.java +++ b/src/java/org/apache/cassandra/utils/SimpleCondition.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -37,7 +37,7 @@ public class SimpleCondition implements Condition while (!set) wait(); } - + public synchronized void reset() { set = false; diff --git a/src/java/org/apache/cassandra/utils/SkipNullRepresenter.java b/src/java/org/apache/cassandra/utils/SkipNullRepresenter.java index 184e68f8e0..b32711861a 100644 --- a/src/java/org/apache/cassandra/utils/SkipNullRepresenter.java +++ b/src/java/org/apache/cassandra/utils/SkipNullRepresenter.java @@ -27,13 +27,13 @@ import org.yaml.snakeyaml.representer.Representer; /* used to prevent null values from being included in generated YAML */ public class SkipNullRepresenter extends Representer { - protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) + protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { - if (propertyValue == null) + if (propertyValue == null) { return null; - } - else + } + else { return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); } diff --git a/src/java/org/apache/cassandra/utils/SlabAllocator.java b/src/java/org/apache/cassandra/utils/SlabAllocator.java index 596c07e322..b6ca040224 100644 --- a/src/java/org/apache/cassandra/utils/SlabAllocator.java +++ b/src/java/org/apache/cassandra/utils/SlabAllocator.java @@ -80,7 +80,7 @@ public class SlabAllocator extends Allocator currentRegion.compareAndSet(region, null); } } - + /** * Get the current region, or, if there is no current region, allocate a new one */ diff --git a/src/java/org/apache/cassandra/utils/StatusLogger.java b/src/java/org/apache/cassandra/utils/StatusLogger.java index 4001d13a4e..9d1ff689d8 100644 --- a/src/java/org/apache/cassandra/utils/StatusLogger.java +++ b/src/java/org/apache/cassandra/utils/StatusLogger.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -51,7 +51,7 @@ public class StatusLogger public static void log() { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); - + // everything from o.a.c.concurrent logger.info(String.format("%-25s%10s%10s%10s", "Pool Name", "Active", "Pending", "Blocked")); Set request, internal; diff --git a/src/java/org/apache/cassandra/utils/Throttle.java b/src/java/org/apache/cassandra/utils/Throttle.java index 598d56ffde..c5f7632314 100644 --- a/src/java/org/apache/cassandra/utils/Throttle.java +++ b/src/java/org/apache/cassandra/utils/Throttle.java @@ -95,7 +95,7 @@ public class Throttle { return "Throttle(for=" + name + ")"; } - + public interface ThroughputFunction { /** diff --git a/src/java/org/apache/cassandra/utils/UUIDGen.java b/src/java/org/apache/cassandra/utils/UUIDGen.java index 75828f01f1..e08281ef8b 100644 --- a/src/java/org/apache/cassandra/utils/UUIDGen.java +++ b/src/java/org/apache/cassandra/utils/UUIDGen.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.*; @@ -38,10 +38,10 @@ public class UUIDGen // A grand day! millis at 00:00:00.000 15 Oct 1582. private static final long START_EPOCH = -12219292800000L; private static final long clock = new Random(System.currentTimeMillis()).nextLong(); - + // placement of this singleton is important. It needs to be instantiated *AFTER* the other statics. private static final UUIDGen instance = new UUIDGen(); - + private long lastNanos; private final Map nodeCache = new HashMap(); @@ -74,11 +74,11 @@ public class UUIDGen // make sure someone didn't whack the clock by changing the order of instantiation. if (clock == 0) throw new RuntimeException("singleton instantiation is misplaced."); } - + /** * Creates a type 1 UUID (time-based UUID) that substitutes a hash of * an IP address in place of the MAC (unavailable to Java). - * + * * @param addr the host address to use * @return a UUID instance */ @@ -86,7 +86,7 @@ public class UUIDGen { return new UUID(instance.createTimeSafe(), instance.getClockSeqAndNode(addr)); } - + /** creates a type 1 uuid from raw bytes. */ public static UUID getUUID(ByteBuffer raw) { @@ -119,25 +119,25 @@ public class UUIDGen } return b; } - + /** * Returns a 16 byte representation of a type 1 UUID (a time-based UUID), * based on the current system time. - * + * * @return a type 1 UUID represented as a byte[] */ public static byte[] getTimeUUIDBytes() { return createTimeUUIDBytes(instance.createTimeSafe()); } - + /** * Converts a milliseconds-since-epoch timestamp into the 16 byte representation * of a type 1 UUID (a time-based UUID). - * + * *

Warning: This method is not guaranteed to return unique UUIDs; Multiple * invocations using identical timestamps will result in identical UUIDs.

- * + * * @param timeMillis * @return a type 1 UUID represented as a byte[] */ @@ -145,24 +145,24 @@ public class UUIDGen { return createTimeUUIDBytes(instance.createTimeUnsafe(timeMillis)); } - + private static byte[] createTimeUUIDBytes(long msb) { long lsb = instance.getClockSeqAndNode(FBUtilities.getLocalAddress()); byte[] uuidBytes = new byte[16]; - + for (int i = 0; i < 8; i++) uuidBytes[i] = (byte) (msb >>> 8 * (7 - i)); - + for (int i = 8; i < 16; i++) uuidBytes[i] = (byte) (lsb >>> 8 * (7 - i)); - + return uuidBytes; } - + /** * Returns a milliseconds-since-epoch value for a type-1 UUID. - * + * * @param uuid a type-1 (time-based) UUID * @return the number of milliseconds since the unix epoch * @throws IllegalArgumentException if the UUID is not version 1 @@ -180,11 +180,11 @@ public class UUIDGen long lsb = 0; lsb |= (clock & 0x3f00000000000000L) >>> 56; // was 58? lsb |= 0x0000000000000080; - lsb |= (clock & 0x00ff000000000000L) >>> 48; + lsb |= (clock & 0x00ff000000000000L) >>> 48; lsb |= makeNode(addr); return lsb; } - + // needs to return two different values for the same when. // we can generate at most 10k UUIDs per ms. private synchronized long createTimeSafe() @@ -194,7 +194,7 @@ public class UUIDGen lastNanos = nanosSince; else nanosSince = ++lastNanos; - + return createTime(nanosSince); } @@ -203,12 +203,12 @@ public class UUIDGen long nanosSince = (when - START_EPOCH) * 10000; return createTime(nanosSince); } - + private long createTime(long nanosSince) - { - long msb = 0L; + { + long msb = 0L; msb |= (0x00000000ffffffffL & nanosSince) << 32; - msb |= (0x0000ffff00000000L & nanosSince) >>> 16; + msb |= (0x0000ffff00000000L & nanosSince) >>> 16; msb |= (0xffff000000000000L & nanosSince) >>> 48; msb |= 0x0000000000001000L; // sets the version to 1. return msb; @@ -219,16 +219,16 @@ public class UUIDGen { if (nodeCache.containsKey(addr)) return nodeCache.get(addr); - + // ideally, we'd use the MAC address, but java doesn't expose that. byte[] hash = hash(addr.toString()); long node = 0; for (int i = 0; i < Math.min(6, hash.length); i++) node |= (0x00000000000000ff & (long)hash[i]) << (5-i)*8; assert (0xff00000000000000L & node) == 0; - + nodeCache.put(addr, node); - + return node; } diff --git a/src/java/org/apache/cassandra/utils/WrappedRunnable.java b/src/java/org/apache/cassandra/utils/WrappedRunnable.java index 392749a320..2ae0d6cfc7 100644 --- a/src/java/org/apache/cassandra/utils/WrappedRunnable.java +++ b/src/java/org/apache/cassandra/utils/WrappedRunnable.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java b/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java index da898044f3..4ecb3d9db7 100644 --- a/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java +++ b/src/java/org/apache/cassandra/utils/obs/OpenBitSet.java @@ -59,7 +59,7 @@ public class OpenBitSet implements Serializable { * Constructs an OpenBitSet large enough to hold numBits. * @param numBits */ - public OpenBitSet(long numBits) + public OpenBitSet(long numBits) { wlen = bits2words(numBits); int lastPageSize = wlen % PAGE_SIZE; @@ -86,7 +86,7 @@ public class OpenBitSet implements Serializable { { return PAGE_SIZE; } - + public int getPageCount() { return pageCount; @@ -96,7 +96,7 @@ public class OpenBitSet implements Serializable { { return bits[pageIdx]; } - + /** Contructs an OpenBitset from a BitSet */ public OpenBitSet(BitSet bits) { @@ -240,7 +240,7 @@ public class OpenBitSet implements Serializable { bits[startWord / PAGE_SIZE][startWord % PAGE_SIZE] &= (startmask | endmask); return; } - + bits[startWord / PAGE_SIZE][startWord % PAGE_SIZE] &= startmask; @@ -372,12 +372,12 @@ public class OpenBitSet implements Serializable { } /** @return the number of set bits */ - public long cardinality() + public long cardinality() { long bitCount = 0L; for (int i=getPageCount();i-->0;) bitCount+=BitUtil.pop_array(bits[i],0,wlen); - + return bitCount; } @@ -435,7 +435,7 @@ public class OpenBitSet implements Serializable { while(--pos>=0) { thisArr[pos / thisPageSize][ pos % thisPageSize] &= otherArr[pos / otherPageSize][pos % otherPageSize]; } - + if (this.wlen > newLen) { // fill zeros from the new shorter length to the old length for (pos=wlen;pos-->newLen;) @@ -478,7 +478,7 @@ public class OpenBitSet implements Serializable { } else { a=this; } - + int aPageSize = this.PAGE_SIZE; int bPageSize = b.PAGE_SIZE; diff --git a/test/long/org/apache/cassandra/db/MeteredFlusherTest.java b/test/long/org/apache/cassandra/db/MeteredFlusherTest.java index aa1fdd2640..bb29bf1b88 100644 --- a/test/long/org/apache/cassandra/db/MeteredFlusherTest.java +++ b/test/long/org/apache/cassandra/db/MeteredFlusherTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/AbstractSerializationsTester.java b/test/unit/org/apache/cassandra/AbstractSerializationsTester.java index dbc14507b7..e908ae7c32 100644 --- a/test/unit/org/apache/cassandra/AbstractSerializationsTester.java +++ b/test/unit/org/apache/cassandra/AbstractSerializationsTester.java @@ -1,6 +1,6 @@ package org.apache.cassandra; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -33,25 +33,25 @@ import java.util.Map; public class AbstractSerializationsTester extends CleanupHelper { protected static final String CUR_VER = System.getProperty("cassandra.version", "0.7"); - protected static final Map VERSION_MAP = new HashMap () + protected static final Map VERSION_MAP = new HashMap () {{ put("0.7", 1); }}; - + protected static final boolean EXECUTE_WRITES = new Boolean(System.getProperty("cassandra.test-serialization-writes", "False")).booleanValue(); - + protected final int getVersion() { return VERSION_MAP.get(CUR_VER); } - + protected static DataInputStream getInput(String name) throws IOException { File f = new File("test/data/serialization/" + CUR_VER + "/" + name); assert f.exists() : f.getPath(); return new DataInputStream(new FileInputStream(f)); } - + protected static DataOutputStream getOutput(String name) throws IOException { File f = new File("test/data/serialization/" + CUR_VER + "/" + name); diff --git a/test/unit/org/apache/cassandra/EmbeddedServer.java b/test/unit/org/apache/cassandra/EmbeddedServer.java index 7317afeea1..24b3afaa34 100644 --- a/test/unit/org/apache/cassandra/EmbeddedServer.java +++ b/test/unit/org/apache/cassandra/EmbeddedServer.java @@ -30,19 +30,19 @@ import org.junit.BeforeClass; public class EmbeddedServer extends CleanupHelper { protected static CassandraDaemon daemon = null; - + enum GatewayService { Thrift } - + public static GatewayService getDaemonGatewayService() { return GatewayService.Thrift; } - + static ExecutorService executor = Executors.newSingleThreadExecutor(); - + @BeforeClass public static void startCassandra() throws IOException @@ -69,7 +69,7 @@ public class EmbeddedServer extends CleanupHelper throw new AssertionError(e); } } - + @AfterClass public static void stopCassandra() throws Exception { @@ -80,5 +80,5 @@ public class EmbeddedServer extends CleanupHelper executor.shutdown(); executor.shutdownNow(); } - + } diff --git a/test/unit/org/apache/cassandra/SchemaLoader.java b/test/unit/org/apache/cassandra/SchemaLoader.java index 697d4664a1..124962f1c0 100644 --- a/test/unit/org/apache/cassandra/SchemaLoader.java +++ b/test/unit/org/apache/cassandra/SchemaLoader.java @@ -80,7 +80,7 @@ public class SchemaLoader String ks_kcs = "KeyCacheSpace"; String ks_rcs = "RowCacheSpace"; String ks_nocommit = "NoCommitlogSpace"; - + Class simple = SimpleStrategy.class; Map opts_rf1 = KSMetaData.optsWithRF(1); @@ -97,7 +97,7 @@ public class SchemaLoader aliases.put((byte)'b', BytesType.instance); aliases.put((byte)'t', TimeUUIDType.instance); AbstractType dynamicComposite = DynamicCompositeType.getInstance(aliases); - + // these column definitions will will be applied to the jdbc utf and integer column familes respectively. Map integerColumn = new HashMap(); integerColumn.put(IntegerType.instance.fromString("42"), new ColumnDefinition( @@ -248,7 +248,7 @@ public class SchemaLoader if (Boolean.parseBoolean(System.getProperty("cassandra.test.compression", "false"))) useCompression(schema); - + return schema; } diff --git a/test/unit/org/apache/cassandra/Util.java b/test/unit/org/apache/cassandra/Util.java index 68ae2289a6..0a376b496c 100644 --- a/test/unit/org/apache/cassandra/Util.java +++ b/test/unit/org/apache/cassandra/Util.java @@ -1,6 +1,6 @@ package org.apache.cassandra; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.EOFException; @@ -112,7 +112,7 @@ public class Util bb.rewind(); return bb; } - + public static ByteBuffer getBytes(int v) { byte[] bytes = new byte[4]; @@ -121,7 +121,7 @@ public class Util bb.rewind(); return bb; } - + public static List getRangeSlice(ColumnFamilyStore cfs) throws IOException, ExecutionException, InterruptedException { return getRangeSlice(cfs, null); diff --git a/test/unit/org/apache/cassandra/cache/CacheProviderTest.java b/test/unit/org/apache/cassandra/cache/CacheProviderTest.java index f872778a4b..fa8a4eacf1 100644 --- a/test/unit/org/apache/cassandra/cache/CacheProviderTest.java +++ b/test/unit/org/apache/cassandra/cache/CacheProviderTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cache; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cache; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -55,7 +55,7 @@ public class CacheProviderTest extends SchemaLoader cache.put(key3, cf); cache.put(key4, cf); cache.put(key5, cf); - + assertEquals(CAPACITY, cache.size()); } @@ -101,7 +101,7 @@ public class CacheProviderTest extends SchemaLoader cf.addColumn(column("awesome", "vijay", 1)); return cf; } - + @Test public void testHeapCache() throws InterruptedException { diff --git a/test/unit/org/apache/cassandra/cli/CliTest.java b/test/unit/org/apache/cassandra/cli/CliTest.java index db93aed55e..b87c56a498 100644 --- a/test/unit/org/apache/cassandra/cli/CliTest.java +++ b/test/unit/org/apache/cassandra/cli/CliTest.java @@ -205,7 +205,7 @@ public class CliTest extends CleanupHelper "show schema", "show schema TestKeySpace" }; - + @Test public void testCli() throws IOException, TException, ConfigurationException, ClassNotFoundException, TimedOutException, NotFoundException, SchemaDisagreementException, NoSuchFieldException, InvalidRequestException, UnavailableException, InstantiationException, IllegalAccessException { diff --git a/test/unit/org/apache/cassandra/client/TestRingCache.java b/test/unit/org/apache/cassandra/client/TestRingCache.java index 4fae42b7f3..c16e336620 100644 --- a/test/unit/org/apache/cassandra/client/TestRingCache.java +++ b/test/unit/org/apache/cassandra/client/TestRingCache.java @@ -51,7 +51,7 @@ public class TestRingCache ConfigHelper.setOutputColumnFamily(conf, keyspace, "Standard1"); ringCache = new RingCache(conf); } - + private void setup(String server, int port) throws Exception { /* Establish a thrift connection to the cassandra instance */ @@ -81,7 +81,7 @@ public class TestRingCache int minRow; int maxRow; String rowPrefix, keyspace = "Keyspace1"; - + if (args.length > 0) { keyspace = args[0]; @@ -95,7 +95,7 @@ public class TestRingCache maxRow = 10; rowPrefix = "row"; } - + TestRingCache tester = new TestRingCache(keyspace); for (int nRows = minRow; nRows < maxRow; nRows++) diff --git a/test/unit/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutorTest.java b/test/unit/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutorTest.java index 54f0c2ede3..4b0e9c4662 100644 --- a/test/unit/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutorTest.java +++ b/test/unit/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutorTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.concurrent; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.concurrent; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java b/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java index 253f06147c..7e3d698d79 100644 --- a/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java +++ b/test/unit/org/apache/cassandra/config/ColumnDefinitionTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.config; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.config; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java b/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java index 1cb2b64c5b..b79e8a3bd5 100644 --- a/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java +++ b/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java @@ -57,7 +57,7 @@ public class DatabaseDescriptorTest assert ksmDupe.equals(ksm); } } - + // this came as a result of CASSANDRA-995 @Test public void testTransKsMigration() throws IOException, ConfigurationException diff --git a/test/unit/org/apache/cassandra/cql/jdbc/ClientUtilsTest.java b/test/unit/org/apache/cassandra/cql/jdbc/ClientUtilsTest.java index b27d73062d..76362bf2ad 100644 --- a/test/unit/org/apache/cassandra/cql/jdbc/ClientUtilsTest.java +++ b/test/unit/org/apache/cassandra/cql/jdbc/ClientUtilsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.cql.jdbc; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.cql.jdbc; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/db/ArrayBackedSortedColumnsTest.java b/test/unit/org/apache/cassandra/db/ArrayBackedSortedColumnsTest.java index 8cfbb21c8a..01283c2de7 100644 --- a/test/unit/org/apache/cassandra/db/ArrayBackedSortedColumnsTest.java +++ b/test/unit/org/apache/cassandra/db/ArrayBackedSortedColumnsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java index 9c871bf55d..85269b7cb7 100644 --- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java +++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java @@ -197,13 +197,13 @@ public class ColumnFamilyStoreTest extends CleanupHelper assert rows != null; assert rows.size() == 2 : StringUtils.join(rows, ","); - - String key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); + + String key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); assert "k1".equals( key ) : key; - - key = new String(rows.get(1).key.key.array(),rows.get(1).key.key.position(),rows.get(1).key.key.remaining()); + + key = new String(rows.get(1).key.key.array(),rows.get(1).key.key.position(),rows.get(1).key.key.remaining()); assert "k3".equals(key) : key; - + assert ByteBufferUtil.bytes(1L).equals( rows.get(0).cf.getColumn(ByteBufferUtil.bytes("birthdate")).value()); assert ByteBufferUtil.bytes(1L).equals( rows.get(1).cf.getColumn(ByteBufferUtil.bytes("birthdate")).value()); @@ -213,26 +213,26 @@ public class ColumnFamilyStoreTest extends CleanupHelper rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").search(clause, range, 100, filter); assert rows.size() == 1 : StringUtils.join(rows, ","); - key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); + key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); assert "k3".equals( key ); - + // same query again, but with resultset not including the subordinate expression rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").search(clause, range, 100, new NamesQueryFilter(ByteBufferUtil.bytes("birthdate"))); assert rows.size() == 1 : StringUtils.join(rows, ","); - key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); + key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); assert "k3".equals( key ); - + assert rows.get(0).cf.getColumnCount() == 1 : rows.get(0).cf; // once more, this time with a slice rowset that needs to be expanded SliceQueryFilter emptyFilter = new SliceQueryFilter(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 0); rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").search(clause, range, 100, emptyFilter); - + assert rows.size() == 1 : StringUtils.join(rows, ","); - key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); + key = new String(rows.get(0).key.key.array(),rows.get(0).key.key.position(),rows.get(0).key.key.remaining()); assert "k3".equals( key ); - + assert rows.get(0).cf.getColumnCount() == 0; // query with index hit but rejected by secondary clause, with a small enough count that just checking count @@ -395,7 +395,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper rows = table.getColumnFamilyStore("Indexed1").search(clause, range, 100, filter); String key = ByteBufferUtil.string(rows.get(0).key.key); assert "k1".equals( key ); - + // update the birthdate value with an OLDER timestamp, and test that the index ignores this rm = new RowMutation("Keyspace2", ByteBufferUtil.bytes("k1")); rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(3L), 0); @@ -404,7 +404,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper rows = table.getColumnFamilyStore("Indexed1").search(clause, range, 100, filter); key = ByteBufferUtil.string(rows.get(0).key.key); assert "k1".equals( key ); - + } // See CASSANDRA-2628 @@ -513,59 +513,59 @@ public class ColumnFamilyStoreTest extends CleanupHelper Table table = Table.open(tableName); ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName); DecoratedKey key = Util.dk("flush-resurrection"); - + // create an isolated sstable. - putColsSuper(cfs, key, scfName, + putColsSuper(cfs, key, scfName, new Column(getBytes(1L), ByteBufferUtil.bytes("val1"), 1), new Column(getBytes(2L), ByteBufferUtil.bytes("val2"), 1), new Column(getBytes(3L), ByteBufferUtil.bytes("val3"), 1)); cfs.forceBlockingFlush(); - + // insert, don't flush. - putColsSuper(cfs, key, scfName, + putColsSuper(cfs, key, scfName, new Column(getBytes(4L), ByteBufferUtil.bytes("val4"), 1), new Column(getBytes(5L), ByteBufferUtil.bytes("val5"), 1), new Column(getBytes(6L), ByteBufferUtil.bytes("val6"), 1)); - + // verify insert. final SlicePredicate sp = new SlicePredicate(); sp.setSlice_range(new SliceRange()); sp.getSlice_range().setCount(100); sp.getSlice_range().setStart(ArrayUtils.EMPTY_BYTE_ARRAY); sp.getSlice_range().setFinish(ArrayUtils.EMPTY_BYTE_ARRAY); - + assertRowAndColCount(1, 6, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // deeleet. RowMutation rm = new RowMutation(table.name, key.key); rm.delete(new QueryPath(cfName, scfName), 2); rm.apply(); - + // verify delete. assertRowAndColCount(1, 0, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // flush cfs.forceBlockingFlush(); - + // re-verify delete. assertRowAndColCount(1, 0, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // late insert. - putColsSuper(cfs, key, scfName, + putColsSuper(cfs, key, scfName, new Column(getBytes(4L), ByteBufferUtil.bytes("val4"), 1L), new Column(getBytes(7L), ByteBufferUtil.bytes("val7"), 1L)); - + // re-verify delete. assertRowAndColCount(1, 0, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // make sure new writes are recognized. - putColsSuper(cfs, key, scfName, + putColsSuper(cfs, key, scfName, new Column(getBytes(3L), ByteBufferUtil.bytes("val3"), 3), new Column(getBytes(8L), ByteBufferUtil.bytes("val8"), 3), new Column(getBytes(9L), ByteBufferUtil.bytes("val9"), 3)); assertRowAndColCount(1, 3, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); } - + private static void assertRowAndColCount(int rowCount, int colCount, ByteBuffer sc, boolean isDeleted, Collection rows) throws CharacterCodingException { assert rows.size() == rowCount : "rowcount " + rows.size(); @@ -580,7 +580,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper assert row.cf.isMarkedForDelete() : "cf not marked for delete"; } } - + private static String str(ColumnFamily cf) throws CharacterCodingException { StringBuilder sb = new StringBuilder(); @@ -588,7 +588,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper sb.append(String.format("(%s,%s,%d),", ByteBufferUtil.string(col.name()), ByteBufferUtil.string(col.value()), col.timestamp())); return sb.toString(); } - + private static void putColsSuper(ColumnFamilyStore cfs, DecoratedKey key, ByteBuffer scfName, Column... cols) throws Throwable { RowMutation rm = new RowMutation(cfs.table.name, key.key); @@ -610,7 +610,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper rm.add(cf); rm.apply(); } - + @Test public void testDeleteStandardRowSticksAfterFlush() throws Throwable { @@ -620,53 +620,53 @@ public class ColumnFamilyStoreTest extends CleanupHelper Table table = Table.open(tableName); ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName); DecoratedKey key = Util.dk("f-flush-resurrection"); - + SlicePredicate sp = new SlicePredicate(); sp.setSlice_range(new SliceRange()); sp.getSlice_range().setCount(100); sp.getSlice_range().setStart(ArrayUtils.EMPTY_BYTE_ARRAY); sp.getSlice_range().setFinish(ArrayUtils.EMPTY_BYTE_ARRAY); - + // insert putColsStandard(cfs, key, column("col1", "val1", 1), column("col2", "val2", 1)); assertRowAndColCount(1, 2, null, false, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // flush. cfs.forceBlockingFlush(); - + // insert, don't flush putColsStandard(cfs, key, column("col3", "val3", 1), column("col4", "val4", 1)); assertRowAndColCount(1, 4, null, false, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // delete (from sstable and memtable) RowMutation rm = new RowMutation(table.name, key.key); rm.delete(new QueryPath(cfs.columnFamily, null, null), 2); rm.apply(); - + // verify delete assertRowAndColCount(1, 0, null, true, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // flush cfs.forceBlockingFlush(); - + // re-verify delete. // first breakage is right here because of CASSANDRA-1837. assertRowAndColCount(1, 0, null, true, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // simulate a 'late' insertion that gets put in after the deletion. should get inserted, but fail on read. putColsStandard(cfs, key, column("col5", "val5", 1), column("col2", "val2", 1)); - + // should still be nothing there because we deleted this row. 2nd breakage, but was undetected because of 1837. assertRowAndColCount(1, 0, null, true, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // make sure that new writes are recognized. putColsStandard(cfs, key, column("col6", "val6", 3), column("col7", "val7", 3)); assertRowAndColCount(1, 2, null, true, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); - + // and it remains so after flush. (this wasn't failing before, but it's good to check.) cfs.forceBlockingFlush(); assertRowAndColCount(1, 2, null, true, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator()), null)); } - + private ColumnFamilyStore insertKey1Key2() throws IOException, ExecutionException, InterruptedException { @@ -682,7 +682,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper rms.add(rm); return Util.writeColumnFamily(rms); } - + @Test public void testBackupAfterFlush() throws Throwable { @@ -696,7 +696,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper assertTrue("can not find backedup file:" + desc.filenameFor(c), new File(desc.filenameFor(c)).exists()); } } - + @Test public void testSuperSliceByNamesCommand() throws Throwable { @@ -720,7 +720,7 @@ public class ColumnFamilyStoreTest extends CleanupHelper SuperColumn superColumn = (SuperColumn) cf.getColumn(superColName); assertColumns(superColumn, "c1", "c2"); } - + // CASSANDRA-3467. the key here is that supercolumn and subcolumn comparators are different @Test public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable @@ -736,19 +736,19 @@ public class ColumnFamilyStoreTest extends CleanupHelper putColsSuper(cfs, key, superColName, new Column(ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("A"), 1), new Column(ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("B"), 1)); - // Get the entire supercolumn like normal + // Get the entire supercolumn like normal IColumn columnGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName, superColName))).getColumn(superColName); assertEquals(ByteBufferUtil.bytes("A"), columnGet.getSubColumn(ByteBufferUtil.bytes("a")).value()); assertEquals(ByteBufferUtil.bytes("B"), columnGet.getSubColumn(ByteBufferUtil.bytes("b")).value()); - // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get + // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get ArrayList sliceColNames = new ArrayList(); sliceColNames.add(ByteBufferUtil.bytes("a")); sliceColNames.add(ByteBufferUtil.bytes("b")); SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(tableName, key.key, new QueryPath(cfName, superColName), sliceColNames); IColumn columnSliced = cmd.getRow(table).cf.getColumn(superColName); - // Make sure the slice returns the same as the straight get + // Make sure the slice returns the same as the straight get assertEquals(ByteBufferUtil.bytes("A"), columnSliced.getSubColumn(ByteBufferUtil.bytes("a")).value()); assertEquals(ByteBufferUtil.bytes("B"), columnSliced.getSubColumn(ByteBufferUtil.bytes("b")).value()); } diff --git a/test/unit/org/apache/cassandra/db/CommitLogTest.java b/test/unit/org/apache/cassandra/db/CommitLogTest.java index 83f780cc6c..7f8bd832b0 100644 --- a/test/unit/org/apache/cassandra/db/CommitLogTest.java +++ b/test/unit/org/apache/cassandra/db/CommitLogTest.java @@ -75,7 +75,7 @@ public class CommitLogTest extends CleanupHelper checksum.update(100); testRecoveryWithBadSizeArgument(100, 100, ~checksum.getValue()); } - + @Test public void testRecoveryWithZeroSegmentSizeArgument() throws Exception { @@ -164,7 +164,7 @@ public class CommitLogTest extends CleanupHelper public void testExceedSegmentSizeWithOverhead() throws Exception { CommitLog.instance.resetUnsafe(); - + RowMutation rm = new RowMutation("Keyspace1", bytes("k")); rm.add(new QueryPath("Standard1", null, bytes("c1")), ByteBuffer.allocate((128 * 1024 * 1024) - 83), 0); CommitLog.instance.add(rm); diff --git a/test/unit/org/apache/cassandra/db/DefsTest.java b/test/unit/org/apache/cassandra/db/DefsTest.java index 9bfa82c1bf..6fb8a01a40 100644 --- a/test/unit/org/apache/cassandra/db/DefsTest.java +++ b/test/unit/org/apache/cassandra/db/DefsTest.java @@ -71,17 +71,17 @@ public class DefsTest extends CleanupHelper @Test public void ensureStaticCFMIdsAreLessThan1000() { - assert CFMetaData.StatusCf.cfId == 0; - assert CFMetaData.HintsCf.cfId == 1; - assert CFMetaData.MigrationsCf.cfId == 2; - assert CFMetaData.SchemaCf.cfId == 3; + assert CFMetaData.StatusCf.cfId == 0; + assert CFMetaData.HintsCf.cfId == 1; + assert CFMetaData.MigrationsCf.cfId == 2; + assert CFMetaData.SchemaCf.cfId == 3; } - + @Test public void testCFMetaDataApply() throws ConfigurationException { Map indexes = new HashMap(); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) { ByteBuffer name = ByteBuffer.wrap(new byte[] { (byte)i }); indexes.put(name, new ColumnDefinition(name, BytesType.instance, IndexType.KEYS, null, Integer.toString(i))); @@ -104,7 +104,7 @@ public class DefsTest extends CleanupHelper // we'll be adding this one later. make sure it's not already there. assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) == null; CfDef cfDef = cfm.toThrift(); - + // add one. ColumnDef addIndexDef = new ColumnDef(); addIndexDef.index_name = "5"; @@ -112,7 +112,7 @@ public class DefsTest extends CleanupHelper addIndexDef.name = ByteBuffer.wrap(new byte[] { 5 }); addIndexDef.validation_class = BytesType.class.getName(); cfDef.column_metadata.add(addIndexDef); - + // remove one. ColumnDef removeIndexDef = new ColumnDef(); removeIndexDef.index_name = "0"; @@ -120,22 +120,22 @@ public class DefsTest extends CleanupHelper removeIndexDef.name = ByteBuffer.wrap(new byte[] { 0 }); removeIndexDef.validation_class = BytesType.class.getName(); assert cfDef.column_metadata.remove(removeIndexDef); - + cfm.apply(cfDef); - + for (int i = 1; i < indexes.size(); i++) assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 1 })) != null; assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 0 })) == null; assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) != null; } - + @Test public void testInvalidNames() throws IOException { String[] valid = {"1", "a", "_1", "b_", "__", "1_a"}; for (String s : valid) assert Migration.isLegalName(s); - + String[] invalid = {"b@t", "dash-y", "", " ", "dot.s", ".hidden"}; for (String s : invalid) assert !Migration.isLegalName(s); @@ -177,7 +177,7 @@ public class DefsTest extends CleanupHelper throw new AssertionError("Unexpected exception."); } } - + @Test public void addNewCfWithNullComment() throws ConfigurationException, IOException, ExecutionException, InterruptedException { @@ -217,7 +217,7 @@ public class DefsTest extends CleanupHelper ColumnFamilyStore store = Table.open(ks).getColumnFamilyStore(cf); assert store != null; store.forceBlockingFlush(); - + ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cf), ByteBufferUtil.bytes("col0"))); assert cfam.getColumn(ByteBufferUtil.bytes("col0")) != null; IColumn col = cfam.getColumn(ByteBufferUtil.bytes("col0")); @@ -233,7 +233,7 @@ public class DefsTest extends CleanupHelper assert ks != null; final CFMetaData cfm = ks.cfMetaData().get("Standard1"); assert cfm != null; - + // write some data, force a flush, then verify that files exist on disk. RowMutation rm = new RowMutation(ks.name, dk.key); for (int i = 0; i < 100; i++) @@ -244,11 +244,11 @@ public class DefsTest extends CleanupHelper store.forceBlockingFlush(); store.getFlushPath(1024, Descriptor.CURRENT_VERSION); assert store.directories.sstableLister().list().size() > 0; - + new DropColumnFamily(ks.name, cfm.cfName).apply(); assert !Schema.instance.getTableDefinition(ks.name).cfMetaData().containsKey(cfm.cfName); - + // any write should fail. rm = new RowMutation(ks.name, dk.key); boolean success = true; @@ -278,7 +278,7 @@ public class DefsTest extends CleanupHelper CFMetaData newCf = addTestCF("NewKeyspace1", "AddedStandard1", "A new cf for a new ks"); KSMetaData newKs = KSMetaData.testMetadata(newCf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5), newCf); - + new AddKeyspace(newKs).apply(); assert Schema.instance.getTableDefinition(newCf.ksName) != null; @@ -291,13 +291,13 @@ public class DefsTest extends CleanupHelper ColumnFamilyStore store = Table.open(newCf.ksName).getColumnFamilyStore(newCf.cfName); assert store != null; store.forceBlockingFlush(); - + ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), ByteBufferUtil.bytes("col0"))); assert cfam.getColumn(ByteBufferUtil.bytes("col0")) != null; IColumn col = cfam.getColumn(ByteBufferUtil.bytes("col0")); assert ByteBufferUtil.bytes("value0").equals(col.value()); } - + @Test public void dropKS() throws ConfigurationException, IOException, ExecutionException, InterruptedException { @@ -317,11 +317,11 @@ public class DefsTest extends CleanupHelper assert store != null; store.forceBlockingFlush(); assert store.directories.sstableLister().list().size() > 0; - + new DropKeyspace(ks.name).apply(); assert Schema.instance.getTableDefinition(ks.name) == null; - + // write should fail. rm = new RowMutation(ks.name, dk.key); boolean success = true; @@ -374,7 +374,7 @@ public class DefsTest extends CleanupHelper public void createEmptyKsAddNewCf() throws ConfigurationException, IOException, ExecutionException, InterruptedException { assert Schema.instance.getTableDefinition("EmptyKeyspace") == null; - + KSMetaData newKs = KSMetaData.testMetadata("EmptyKeyspace", SimpleStrategy.class, KSMetaData.optsWithRF(5)); new AddKeyspace(newKs).apply(); @@ -405,19 +405,19 @@ public class DefsTest extends CleanupHelper IColumn col = cfam.getColumn(ByteBufferUtil.bytes("col0")); assert ByteBufferUtil.bytes("value0").equals(col.value()); } - + @Test public void testUpdateKeyspace() throws ConfigurationException, IOException, ExecutionException, InterruptedException { // create a keyspace to serve as existing. CFMetaData cf = addTestCF("UpdatedKeyspace", "AddedStandard1", "A new cf for a new ks"); KSMetaData oldKs = KSMetaData.testMetadata(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(5), cf); - + new AddKeyspace(oldKs).apply(); assert Schema.instance.getTableDefinition(cf.ksName) != null; assert Schema.instance.getTableDefinition(cf.ksName) == oldKs; - + // anything with cf defs should fail. CFMetaData cf2 = addTestCF(cf.ksName, "AddedStandard2", "A new cf for a new ks"); KSMetaData newBadKs = KSMetaData.testMetadata(cf.ksName, SimpleStrategy.class, KSMetaData.optsWithRF(4), cf2); @@ -430,7 +430,7 @@ public class DefsTest extends CleanupHelper { // expected. } - + // names should match. KSMetaData newBadKs2 = KSMetaData.testMetadata(cf.ksName + "trash", SimpleStrategy.class, KSMetaData.optsWithRF(4)); try @@ -442,7 +442,7 @@ public class DefsTest extends CleanupHelper { // expected. } - + KSMetaData newKs = KSMetaData.testMetadata(cf.ksName, OldNetworkTopologyStrategy.class, KSMetaData.optsWithRF(1)); new UpdateKeyspace(newKs.toThrift()).apply(); @@ -462,24 +462,24 @@ public class DefsTest extends CleanupHelper assert Schema.instance.getTableDefinition(cf.ksName) != null; assert Schema.instance.getTableDefinition(cf.ksName) == ksm; assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName) != null; - + // updating certain fields should fail. CfDef cf_def = cf.toThrift(); cf_def.column_metadata = new ArrayList(); cf_def.default_validation_class ="BytesType"; cf_def.min_compaction_threshold = 5; cf_def.max_compaction_threshold = 31; - + // test valid operations. cf_def.comment = "Modified comment"; new UpdateColumnFamily(cf_def).apply(); // doesn't get set back here. cf_def.read_repair_chance = 0.23; new UpdateColumnFamily(cf_def).apply(); - + cf_def.gc_grace_seconds = 12; new UpdateColumnFamily(cf_def).apply(); - + cf_def.default_validation_class = "UTF8Type"; new UpdateColumnFamily(cf_def).apply(); @@ -490,13 +490,13 @@ public class DefsTest extends CleanupHelper new UpdateColumnFamily(cf_def).apply(); // can't test changing the reconciler because there is only one impl. - + // check the cumulative affect. assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getComment().equals(cf_def.comment); assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getReadRepairChance() == cf_def.read_repair_chance; assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getGcGraceSeconds() == cf_def.gc_grace_seconds; assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName).getDefaultValidator() == UTF8Type.instance; - + // todo: we probably don't need to reset old values in the catches anymore. // make sure some invalid operations fail. int oldId = cf_def.id; @@ -506,11 +506,11 @@ public class DefsTest extends CleanupHelper cf.apply(cf_def); throw new AssertionError("Should have blown up when you used a different id."); } - catch (ConfigurationException expected) + catch (ConfigurationException expected) { - cf_def.id = oldId; + cf_def.id = oldId; } - + String oldStr = cf_def.name; try { @@ -522,7 +522,7 @@ public class DefsTest extends CleanupHelper { cf_def.name = oldStr; } - + oldStr = cf_def.keyspace; try { @@ -534,7 +534,7 @@ public class DefsTest extends CleanupHelper { cf_def.keyspace = oldStr; } - + try { cf_def.column_type = ColumnFamilyType.Super.name(); @@ -545,9 +545,9 @@ public class DefsTest extends CleanupHelper { cf_def.column_type = ColumnFamilyType.Standard.name(); } - + oldStr = cf_def.comparator_type; - try + try { cf_def.comparator_type = TimeUUIDType.class.getSimpleName(); cf.apply(cf_def); diff --git a/test/unit/org/apache/cassandra/db/KeyCacheTest.java b/test/unit/org/apache/cassandra/db/KeyCacheTest.java index c59ce76a45..7af70940dd 100644 --- a/test/unit/org/apache/cassandra/db/KeyCacheTest.java +++ b/test/unit/org/apache/cassandra/db/KeyCacheTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.io.IOException; diff --git a/test/unit/org/apache/cassandra/db/MultitableTest.java b/test/unit/org/apache/cassandra/db/MultitableTest.java index 40bba6e959..f7967b873f 100644 --- a/test/unit/org/apache/cassandra/db/MultitableTest.java +++ b/test/unit/org/apache/cassandra/db/MultitableTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/db/ReadMessageTest.java b/test/unit/org/apache/cassandra/db/ReadMessageTest.java index d5b1066477..27df3d0bc2 100644 --- a/test/unit/org/apache/cassandra/db/ReadMessageTest.java +++ b/test/unit/org/apache/cassandra/db/ReadMessageTest.java @@ -44,10 +44,10 @@ public class ReadMessageTest extends SchemaLoader ArrayList colList = new ArrayList(); colList.add(ByteBufferUtil.bytes("col1")); colList.add(ByteBufferUtil.bytes("col2")); - + ReadCommand rm, rm2; DecoratedKey dk = Util.dk("row1"); - + rm = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), colList); rm2 = serializeAndDeserializeReadMessage(rm); assert rm2.toString().equals(rm.toString()); @@ -55,7 +55,7 @@ public class ReadMessageTest extends SchemaLoader rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2); rm2 = serializeAndDeserializeReadMessage(rm); assert rm2.toString().equals(rm.toString()); - + rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z"), true, 5); rm2 = serializeAndDeserializeReadMessage(rm); assertEquals(rm2.toString(), rm.toString()); @@ -79,7 +79,7 @@ public class ReadMessageTest extends SchemaLoader bis = new ByteArrayInputStream(dos.getData(), 0, dos.getLength()); return rms.deserialize(new DataInputStream(bis), MessagingService.version_); } - + @Test public void testGetColumn() throws IOException, ColumnFamilyNotDefinedException { @@ -97,43 +97,43 @@ public class ReadMessageTest extends SchemaLoader IColumn col = row.cf.getColumn(ByteBufferUtil.bytes("Column1")); assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes())); } - - @Test + + @Test public void testNoCommitLog() throws Exception { - + RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("row")); rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("commit1")), ByteBufferUtil.bytes("abcd"), 0); rm.apply(); - + rm = new RowMutation("NoCommitlogSpace", ByteBufferUtil.bytes("row")); rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("commit2")), ByteBufferUtil.bytes("abcd"), 0); rm.apply(); - + boolean commitLogMessageFound = false; boolean noCommitLogMessageFound = false; - + File commitLogDir = new File(DatabaseDescriptor.getCommitLogLocation()); - + for(String filename : commitLogDir.list()) { BufferedReader f = new BufferedReader(new FileReader(commitLogDir.getAbsolutePath()+File.separator+filename)); - + String line = null; while( (line = f.readLine()) != null) { if(line.contains("commit1")) commitLogMessageFound = true; - + if(line.contains("commit2")) noCommitLogMessageFound = true; } - + f.close(); } - + assertTrue(commitLogMessageFound); - assertFalse(noCommitLogMessageFound); + assertFalse(noCommitLogMessageFound); } - + } diff --git a/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java b/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java index b1a7900f46..0a5054431a 100644 --- a/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java +++ b/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java b/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java index fea4e59f6f..13e041dc9f 100644 --- a/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java +++ b/test/unit/org/apache/cassandra/db/RecoveryManager3Test.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/db/ScrubTest.java b/test/unit/org/apache/cassandra/db/ScrubTest.java index be668de7c4..e7529d74e5 100644 --- a/test/unit/org/apache/cassandra/db/ScrubTest.java +++ b/test/unit/org/apache/cassandra/db/ScrubTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -50,16 +50,16 @@ public class ScrubTest extends CleanupHelper public String CF3 = "Standard2"; public String corruptSSTableName; - - public void copySSTables() throws IOException + + public void copySSTables() throws IOException { String root = System.getProperty("corrupt-sstable-root"); assert root != null; File rootDir = new File(root); assert rootDir.isDirectory(); - + File destDir = Directories.create(TABLE, CF2).getDirectoryForNewSSTables(1); - + FileUtils.createDirectory(destDir); for (File srcFile : rootDir.listFiles()) { @@ -69,23 +69,23 @@ public class ScrubTest extends CleanupHelper CLibrary.createHardLink(srcFile, destFile); assert destFile.exists() : destFile.getAbsoluteFile(); - + if(destFile.getName().endsWith("Data.db")) corruptSSTableName = destFile.getCanonicalPath(); - } + } assert corruptSSTableName != null; } - + @Test public void testScrubFile() throws Exception - { + { copySSTables(); Table table = Table.open(TABLE); ColumnFamilyStore cfs = table.getColumnFamilyStore(CF2); assert cfs.getSSTables().size() > 0; - + List rows; boolean caught = false; try @@ -98,13 +98,13 @@ public class ScrubTest extends CleanupHelper caught = true; } assert caught : "'corrupt' test file actually was not"; - + CompactionManager.instance.performScrub(cfs); rows = cfs.getRangeSlice(ByteBufferUtil.bytes("1"), Util.range("", ""), 1000, new IdentityQueryFilter(), null); assertEquals(100, rows.size()); } - - + + @Test public void testScrubOneRow() throws IOException, ExecutionException, InterruptedException, ConfigurationException { @@ -165,7 +165,7 @@ public class ScrubTest extends CleanupHelper rows = cfs.getRangeSlice(null, Util.range("", ""), 1000, new IdentityQueryFilter(), null); assertEquals(10, rows.size()); } - + protected void fillCF(ColumnFamilyStore cfs, int rowsPerSSTable) throws ExecutionException, InterruptedException, IOException { for (int i = 0; i < rowsPerSSTable; i++) @@ -184,7 +184,7 @@ public class ScrubTest extends CleanupHelper cfs.forceBlockingFlush(); } - - - + + + } diff --git a/test/unit/org/apache/cassandra/db/SerializationsTest.java b/test/unit/org/apache/cassandra/db/SerializationsTest.java index 1fa03d8c44..73a95dd778 100644 --- a/test/unit/org/apache/cassandra/db/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/db/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -59,7 +59,7 @@ public class SerializationsTest extends AbstractSerializationsTester ByteBuffer emptyCol = ByteBufferUtil.bytes(""); SlicePredicate namesPred = new SlicePredicate(); namesPred.column_names = Statics.NamedCols; - SliceRange emptySliceRange = new SliceRange(emptyCol, emptyCol, false, 100); + SliceRange emptySliceRange = new SliceRange(emptyCol, emptyCol, false, 100); SliceRange nonEmptySliceRange = new SliceRange(startCol, stopCol, true, 100); SlicePredicate emptyRangePred = new SlicePredicate(); emptyRangePred.slice_range = emptySliceRange; @@ -67,16 +67,16 @@ public class SerializationsTest extends AbstractSerializationsTester nonEmptyRangePred.slice_range = nonEmptySliceRange; IPartitioner part = StorageService.getPartitioner(); AbstractBounds bounds = new Range(part.getRandomToken(), part.getRandomToken()).toRowBounds(); - + Message namesCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, namesPred, bounds, 100).getMessage(MessagingService.version_); Message emptyRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, emptyRangePred, bounds, 100).getMessage(MessagingService.version_); Message regRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, nonEmptyRangePred, bounds, 100).getMessage(MessagingService.version_); Message namesCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, namesPred, bounds, 100).getMessage(MessagingService.version_); Message emptyRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, emptyRangePred, bounds, 100).getMessage(MessagingService.version_); Message regRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, nonEmptyRangePred, bounds, 100).getMessage(MessagingService.version_); - + DataOutputStream dout = getOutput("db.RangeSliceCommand.bin"); - + messageSerializer.serialize(namesCmd, dout, getVersion()); messageSerializer.serialize(emptyRangeCmd, dout, getVersion()); messageSerializer.serialize(regRangeCmd, dout, getVersion()); @@ -85,13 +85,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(regRangeCmdSup, dout, getVersion()); dout.close(); } - + @Test public void testRangeSliceCommandRead() throws IOException { if (EXECUTE_WRITES) testRangeSliceCommandWrite(); - + DataInputStream in = getInput("db.RangeSliceCommand.bin"); for (int i = 0; i < 6; i++) { @@ -100,12 +100,12 @@ public class SerializationsTest extends AbstractSerializationsTester } in.close(); } - + private void testSliceByNamesReadCommandWrite() throws IOException { SliceByNamesReadCommand standardCmd = new SliceByNamesReadCommand(Statics.KS, Statics.Key, Statics.StandardPath, Statics.NamedCols); SliceByNamesReadCommand superCmd = new SliceByNamesReadCommand(Statics.KS, Statics.Key, Statics.SuperPath, Statics.NamedCols); - + DataOutputStream out = getOutput("db.SliceByNamesReadCommand.bin"); SliceByNamesReadCommand.serializer().serialize(standardCmd, out, getVersion()); SliceByNamesReadCommand.serializer().serialize(superCmd, out, getVersion()); @@ -115,13 +115,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(superCmd.getMessage(getVersion()), out, getVersion()); out.close(); } - - @Test + + @Test public void testSliceByNamesReadCommandRead() throws IOException { if (EXECUTE_WRITES) testSliceByNamesReadCommandWrite(); - + DataInputStream in = getInput("db.SliceByNamesReadCommand.bin"); assert SliceByNamesReadCommand.serializer().deserialize(in, getVersion()) != null; assert SliceByNamesReadCommand.serializer().deserialize(in, getVersion()) != null; @@ -131,7 +131,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testSliceFromReadCommandWrite() throws IOException { SliceFromReadCommand standardCmd = new SliceFromReadCommand(Statics.KS, Statics.Key, Statics.StandardPath, Statics.Start, Statics.Stop, true, 100); @@ -145,13 +145,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(superCmd.getMessage(getVersion()), out, getVersion()); out.close(); } - + @Test public void testSliceFromReadCommandRead() throws IOException { if (EXECUTE_WRITES) testSliceFromReadCommandWrite(); - + DataInputStream in = getInput("db.SliceFromReadCommand.bin"); assert SliceFromReadCommand.serializer().deserialize(in, getVersion()) != null; assert SliceFromReadCommand.serializer().deserialize(in, getVersion()) != null; @@ -161,7 +161,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testRowWrite() throws IOException { DataOutputStream out = getOutput("db.Row.bin"); @@ -170,20 +170,20 @@ public class SerializationsTest extends AbstractSerializationsTester Row.serializer().serialize(Statics.NullRow, out, getVersion()); out.close(); } - + @Test public void testRowRead() throws IOException { if (EXECUTE_WRITES) testRowWrite(); - + DataInputStream in = getInput("db.Row.bin"); assert Row.serializer().deserialize(in, getVersion()) != null; assert Row.serializer().deserialize(in, getVersion()) != null; assert Row.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private void restRowMutationWrite() throws IOException { RowMutation emptyRm = new RowMutation(Statics.KS, Statics.Key); @@ -197,7 +197,7 @@ public class SerializationsTest extends AbstractSerializationsTester mods.put(Statics.StandardCf.metadata().cfId, Statics.StandardCf); mods.put(Statics.SuperCf.metadata().cfId, Statics.SuperCf); RowMutation mixedRm = new RowMutation(Statics.KS, Statics.Key, mods); - + DataOutputStream out = getOutput("db.RowMutation.bin"); RowMutation.serializer().serialize(emptyRm, out, getVersion()); RowMutation.serializer().serialize(standardRowRm, out, getVersion()); @@ -211,15 +211,15 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(standardRm.getMessage(getVersion()), out, getVersion()); messageSerializer.serialize(superRm.getMessage(getVersion()), out, getVersion()); messageSerializer.serialize(mixedRm.getMessage(getVersion()), out, getVersion()); - out.close(); + out.close(); } - + @Test public void testRowMutationRead() throws IOException { if (EXECUTE_WRITES) restRowMutationWrite(); - + DataInputStream in = getInput("db.RowMutation.bin"); assert RowMutation.serializer().deserialize(in, getVersion()) != null; assert RowMutation.serializer().deserialize(in, getVersion()) != null; @@ -235,7 +235,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + public void testTruncateWrite() throws IOException { Truncation tr = new Truncation(Statics.KS, "Doesn't Really Matter"); @@ -251,13 +251,13 @@ public class SerializationsTest extends AbstractSerializationsTester // todo: notice how CF names weren't validated. out.close(); } - + @Test public void testTruncateRead() throws IOException { if (EXECUTE_WRITES) testTruncateWrite(); - + DataInputStream in = getInput("db.Truncation.bin"); assert Truncation.serializer().deserialize(in, getVersion()) != null; assert TruncateResponse.serializer().deserialize(in, getVersion()) != null; @@ -267,7 +267,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testWriteResponseWrite() throws IOException { WriteResponse aff = new WriteResponse(Statics.KS, Statics.Key, true); @@ -277,28 +277,28 @@ public class SerializationsTest extends AbstractSerializationsTester WriteResponse.serializer().serialize(neg, out, getVersion()); out.close(); } - + @Test public void testWriteResponseRead() throws IOException { if (EXECUTE_WRITES) testWriteResponseWrite(); - + DataInputStream in = getInput("db.WriteResponse.bin"); assert WriteResponse.serializer().deserialize(in, getVersion()) != null; assert WriteResponse.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private static ByteBuffer bb(String s) { return ByteBufferUtil.bytes(s); } - - private static class Statics + + private static class Statics { private static final String KS = "Keyspace1"; private static final ByteBuffer Key = ByteBufferUtil.bytes("Key01"); - private static final List NamedCols = new ArrayList() + private static final List NamedCols = new ArrayList() {{ add(ByteBufferUtil.bytes("AAA")); add(ByteBufferUtil.bytes("BBB")); @@ -309,10 +309,10 @@ public class SerializationsTest extends AbstractSerializationsTester private static final QueryPath SuperPath = new QueryPath("Super1", SC); private static final ByteBuffer Start = ByteBufferUtil.bytes("Start"); private static final ByteBuffer Stop = ByteBufferUtil.bytes("Stop"); - + private static final ColumnFamily StandardCf = ColumnFamily.create(Statics.KS, "Standard1"); private static final ColumnFamily SuperCf = ColumnFamily.create(Statics.KS, "Super1"); - + private static final SuperColumn SuperCol = new SuperColumn(Statics.SC, Schema.instance.getComparator(Statics.KS, "Super1")) {{ addColumn(new Column(bb("aaaa"))); @@ -327,7 +327,7 @@ public class SerializationsTest extends AbstractSerializationsTester private static final Row StandardRow = new Row(Util.dk("key0"), Statics.StandardCf); private static final Row SuperRow = new Row(Util.dk("key1"), Statics.SuperCf); private static final Row NullRow = new Row(Util.dk("key2"), null); - + static { StandardCf.addColumn(new Column(bb("aaaa"))); StandardCf.addColumn(new Column(bb("bbbb"), bb("bbbbb-value"))); @@ -336,7 +336,7 @@ public class SerializationsTest extends AbstractSerializationsTester StandardCf.addColumn(new DeletedColumn(bb("eeee"), bb("eeee-value"), 1001)); StandardCf.addColumn(new ExpiringColumn(bb("ffff"), bb("ffff-value"), 2000, 1000)); StandardCf.addColumn(new ExpiringColumn(bb("gggg"), bb("gggg-value"), 2001, 1000, 2002)); - + SuperCf.addColumn(Statics.SuperCol); } } diff --git a/test/unit/org/apache/cassandra/db/SuperColumnTest.java b/test/unit/org/apache/cassandra/db/SuperColumnTest.java index 7c61e7b012..f1d1ba6ac3 100644 --- a/test/unit/org/apache/cassandra/db/SuperColumnTest.java +++ b/test/unit/org/apache/cassandra/db/SuperColumnTest.java @@ -33,7 +33,7 @@ import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.NodeId; public class SuperColumnTest -{ +{ private static final CounterContext cc = new CounterContext(); @Test @@ -70,7 +70,7 @@ public class SuperColumnTest state.writeElement(NodeId.fromInt(3), 6L, 0L); state.writeElement(NodeId.fromInt(7), 3L, 0L); sc.addColumn(new CounterColumn(getBytes(2), state.context, 9L, 0L)); - + assertNotNull(sc.getSubColumn(getBytes(1))); assertNull(sc.getSubColumn(getBytes(3))); diff --git a/test/unit/org/apache/cassandra/db/SystemTableTest.java b/test/unit/org/apache/cassandra/db/SystemTableTest.java index df44b784fb..e4f3d74e11 100644 --- a/test/unit/org/apache/cassandra/db/SystemTableTest.java +++ b/test/unit/org/apache/cassandra/db/SystemTableTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/db/TableTest.java b/test/unit/org/apache/cassandra/db/TableTest.java index 62ae97a6b2..b5a3869eee 100644 --- a/test/unit/org/apache/cassandra/db/TableTest.java +++ b/test/unit/org/apache/cassandra/db/TableTest.java @@ -134,16 +134,16 @@ public class TableTest extends CleanupHelper cf.addColumn(column("c", "val3", 1L)); rm.add(cf); rm.apply(); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("c"), false, 100); assertEquals(2, cf.getColumnCount()); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("b"), false, 100); assertEquals(1, cf.getColumnCount()); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("c"), false, 1); assertEquals(1, cf.getColumnCount()); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("c"), ByteBufferUtil.bytes("b"), false, 1); assertNull(cf); } @@ -365,13 +365,13 @@ public class TableTest extends CleanupHelper cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col2"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 3); assertColumns(cf, "col2", "col3", "col4"); - + ByteBuffer col = cf.getColumn(ByteBufferUtil.bytes("col2")).value(); assertEquals(ByteBufferUtil.string(col), "valx"); - + col = cf.getColumn(ByteBufferUtil.bytes("col3")).value(); assertEquals(ByteBufferUtil.string(col), "valx"); - + col = cf.getColumn(ByteBufferUtil.bytes("col4")).value(); assertEquals(ByteBufferUtil.string(col), "val4"); } @@ -422,26 +422,26 @@ public class TableTest extends CleanupHelper ColumnFamily cf; cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1000"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 3); assertColumns(cf, "col1000", "col1001", "col1002"); - - ByteBuffer col; + + ByteBuffer col; col = cf.getColumn(ByteBufferUtil.bytes("col1000")).value(); assertEquals(ByteBufferUtil.string(col), "v1000"); col = cf.getColumn(ByteBufferUtil.bytes("col1001")).value(); assertEquals(ByteBufferUtil.string(col), "v1001"); col = cf.getColumn(ByteBufferUtil.bytes("col1002")).value(); assertEquals(ByteBufferUtil.string(col), "v1002"); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1195"), ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 3); assertColumns(cf, "col1195", "col1196", "col1197"); - + col = cf.getColumn(ByteBufferUtil.bytes("col1195")).value(); assertEquals(ByteBufferUtil.string(col), "v1195"); col = cf.getColumn(ByteBufferUtil.bytes("col1196")).value(); assertEquals(ByteBufferUtil.string(col), "v1196"); col = cf.getColumn(ByteBufferUtil.bytes("col1197")).value(); assertEquals(ByteBufferUtil.string(col), "v1197"); - - + + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1996"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 1000); IColumn[] columns = cf.getSortedColumns().toArray(new IColumn[0]); for (int i = 1000; i < 1996; i++) @@ -460,7 +460,7 @@ public class TableTest extends CleanupHelper assertEquals(ByteBufferUtil.string(col), "v1991"); col = cf.getColumn(ByteBufferUtil.bytes("col1992")).value(); assertEquals(ByteBufferUtil.string(col), "v1992"); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 3); assertColumns(cf, "col1997", "col1998", "col1999"); col = cf.getColumn(ByteBufferUtil.bytes("col1997")).value(); @@ -469,7 +469,7 @@ public class TableTest extends CleanupHelper assertEquals(ByteBufferUtil.string(col), "v1998"); col = cf.getColumn(ByteBufferUtil.bytes("col1999")).value(); assertEquals(ByteBufferUtil.string(col), "v1999"); - + cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col9000"), ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 3); assertColumns(cf, "col1997", "col1998", "col1999"); @@ -499,9 +499,9 @@ public class TableTest extends CleanupHelper { ColumnFamily cf = cfStore.getColumnFamily(ROW, new QueryPath("Super1"), ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, 10); assertColumns(cf, "sc1"); - + ByteBuffer val = cf.getColumn(ByteBufferUtil.bytes("sc1")).getSubColumn(getBytes(1)).value(); - + assertEquals(ByteBufferUtil.string(val), "val1"); } }; diff --git a/test/unit/org/apache/cassandra/db/context/CounterContextTest.java b/test/unit/org/apache/cassandra/db/context/CounterContextTest.java index 6c59a4b4d2..ae9ffbf8bb 100644 --- a/test/unit/org/apache/cassandra/db/context/CounterContextTest.java +++ b/test/unit/org/apache/cassandra/db/context/CounterContextTest.java @@ -1,5 +1,5 @@ /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ package org.apache.cassandra.db.context; @@ -109,7 +109,7 @@ public class CounterContextTest assert ContextRelationship.GREATER_THAN == cc.diff(left.context, right.context); - + // less than: left has subset of nodes (counts equal) left = ContextState.allocate(3, 0, allocator); left.writeElement(NodeId.fromInt(3), 3L, 0L); @@ -221,7 +221,7 @@ public class CounterContextTest assert ContextRelationship.DISJOINT == cc.diff(left.context, right.context); - + // disjoint: left has less nodes, but higher counts left = ContextState.allocate(3, 0, allocator); left.writeElement(NodeId.fromInt(3), 5L, 0L); diff --git a/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java index db410833a1..108f48ff05 100644 --- a/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/DecimalTypeTest.java @@ -37,43 +37,43 @@ public class DecimalTypeTest private static BigDecimal minus = new BigDecimal("-1.000001"); private static BigDecimal low = new BigDecimal(LOW); private static BigDecimal high = new BigDecimal(HIGH); - + @Test public void test1Decompose_compose() { ByteBuffer bb = DecimalType.instance.decompose(low); - + String string = DecimalType.instance.compose(bb).toPlainString(); - + // check that the decomposed buffer when re-composed is equal to the initial string. assertEquals(LOW, string); - + // check that a null argument yields an empty byte buffer bb = DecimalType.instance.decompose(null); assertEquals(bb, ByteBufferUtil.EMPTY_BYTE_BUFFER); } - + @Test public void test2Compare() { ByteBuffer lowBB = DecimalType.instance.decompose(low); ByteBuffer low2BB = DecimalType.instance.decompose(low); - ByteBuffer highBB = DecimalType.instance.decompose(high); + ByteBuffer highBB = DecimalType.instance.decompose(high); assertEquals(-1, DecimalType.instance.compare(lowBB, highBB)); - + lowBB = DecimalType.instance.decompose(low); highBB = DecimalType.instance.decompose(high); assertEquals(1, DecimalType.instance.compare(highBB, lowBB)); - + lowBB = DecimalType.instance.decompose(low); assertEquals(0, DecimalType.instance.compare(low2BB, lowBB)); - + lowBB = DecimalType.instance.decompose(low); assertEquals(-1, DecimalType.instance.compare(ByteBufferUtil.EMPTY_BYTE_BUFFER, lowBB)); - + lowBB = DecimalType.instance.decompose(low); assertEquals(1, DecimalType.instance.compare(lowBB,ByteBufferUtil.EMPTY_BYTE_BUFFER)); - + assertEquals(0, DecimalType.instance.compare(ByteBufferUtil.EMPTY_BYTE_BUFFER,ByteBufferUtil.EMPTY_BYTE_BUFFER)); } @@ -83,13 +83,13 @@ public class DecimalTypeTest ByteBuffer zeroBB = DecimalType.instance.decompose(zero); ByteBuffer minusBB = DecimalType.instance.decompose(minus); ByteBuffer lowBB = DecimalType.instance.decompose(low); - ByteBuffer highBB = DecimalType.instance.decompose(high); + ByteBuffer highBB = DecimalType.instance.decompose(high); ByteBuffer[] array = {highBB,minusBB,lowBB,lowBB,zeroBB,minusBB}; - + // Sort the array of ByteBuffer using a DecimalType comparator Arrays.sort(array, DecimalType.instance); - + // Check that the array is in order for (int i = 1; i < array.length; i++) { diff --git a/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java b/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java index 9e561113fc..9cb761c4d0 100644 --- a/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -48,7 +48,7 @@ public class RoundTripTest assert IntegerType.instance.compose(ByteBuffer.wrap(bi.toByteArray())).equals(bi); assert JdbcInteger.instance.toString(bi).equals("1"); } - + @Test public void testLong() { @@ -59,7 +59,7 @@ public class RoundTripTest assert LongType.instance.compose(ByteBuffer.wrap(v)) == 1L; assert JdbcLong.instance.toString(1L).equals("1"); } - + @Test public void intLong() { @@ -70,7 +70,7 @@ public class RoundTripTest assert Int32Type.instance.compose(ByteBuffer.wrap(v)) == 1; // assert Int32Type.instance.toString(1).equals("1"); } - + @Test public void testAscii() throws Exception { @@ -81,7 +81,7 @@ public class RoundTripTest assert AsciiType.instance.compose(ByteBuffer.wrap(abc)).equals("abc"); assert JdbcAscii.instance.toString("abc").equals("abc"); } - + @Test public void testBytes() { @@ -93,7 +93,7 @@ public class RoundTripTest assert BytesType.instance.compose(ByteBuffer.wrap(v)).equals(ByteBuffer.wrap(v)); assert JdbcBytes.instance.toString(ByteBuffer.wrap(v)).equals(Hex.bytesToHex(v)); } - + @Test public void testLexicalUUID() { @@ -105,7 +105,7 @@ public class RoundTripTest assert LexicalUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.decompose(uuid))).equals(uuid); assert JdbcLexicalUUID.instance.toString(uuid).equals(uuid.toString()); } - + @Test public void testTimeUUID() { @@ -115,10 +115,10 @@ public class RoundTripTest assert TimeUUIDType.instance.fromString(TimeUUIDType.instance.getString(ByteBuffer.wrap(UUIDGen.decompose(uuid)))) .equals(ByteBuffer.wrap(UUIDGen.decompose(uuid))); assert TimeUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.decompose(uuid))).equals(uuid); - + assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(uuid.toString()))); assert JdbcTimeUUID.instance.toString(uuid).equals(uuid.toString()); - + TimeZone.setDefault(TimeZone.getTimeZone("America/New_York")); Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, 2011); @@ -130,7 +130,7 @@ public class RoundTripTest c.set(Calendar.MILLISECOND, 0); Long ts = new Long(1299560400000L); assert ts.equals(c.getTimeInMillis()) : c.getTimeInMillis(); - + // create a uuid with a known time. uuid = TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(ts.toString())); assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(uuid.toString()))); @@ -143,9 +143,9 @@ public class RoundTripTest assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08T00:00:00"))); assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08T00:00:00-0500"))); assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08"))); - assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08-0500"))); + assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString("2011-03-08-0500"))); } - + @Test public void testUtf8() throws Exception { diff --git a/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java index f41a52829b..256fba46fe 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java @@ -39,7 +39,7 @@ public class TimeUUIDTypeTest { UUID a = UUIDGen.makeType1UUIDFromHost(InetAddress.getLocalHost()); UUID b = new UUID(a.getMostSignificantBits(), a.getLeastSignificantBits()); - + timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(a))); timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(b))); assertEquals(0, timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(a)), ByteBuffer.wrap(UUIDGen.decompose(b)))); @@ -55,7 +55,7 @@ public class TimeUUIDTypeTest timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(a))); timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(b))); timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(c))); - + assert timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(a)), ByteBuffer.wrap(UUIDGen.decompose(b))) < 0; assert timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(b)), ByteBuffer.wrap(UUIDGen.decompose(c))) < 0; assert timeUUIDType.compare(ByteBuffer.wrap(UUIDGen.decompose(a)), ByteBuffer.wrap(UUIDGen.decompose(c))) < 0; @@ -98,7 +98,7 @@ public class TimeUUIDTypeTest assert i0 <= i1; } } - + @Test public void testValidTimeVersion() { @@ -106,7 +106,7 @@ public class TimeUUIDTypeTest assert uuid1.version() == 1; timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid1))); } - + @Test(expected = MarshalException.class) public void testInvalidTimeVersion() { @@ -114,6 +114,6 @@ public class TimeUUIDTypeTest assert uuid2.version() == 2; timeUUIDType.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid2))); } - - + + } diff --git a/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java b/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java index 49bdf9c60d..04b030e13a 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -85,7 +85,7 @@ public class TypeCompareTest for (int i = 1; i < data.length; i++) { - + long l0 = data[i - 1].getLong(data[i - 1].position()); long l1 = data[i].getLong(data[i].position()); assert l0 <= l1; @@ -107,7 +107,7 @@ public class TypeCompareTest for (int i = 1; i < data.length; i++) { - + int l0 = data[i - 1].getInt(data[i - 1].position()); int l1 = data[i].getInt(data[i].position()); assert l0 <= l1; diff --git a/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java b/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java index f12a136036..552582edda 100644 --- a/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/TypeValidationTest.java @@ -17,9 +17,9 @@ import java.util.UUID; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,34 +35,34 @@ public class TypeValidationTest { AsciiType.instance.validate(ByteBuffer.wrap(new byte[]{ (byte)0x80 })); } - + @Test(expected = MarshalException.class) public void testInvalidTimeUUID() { UUID uuid = UUID.randomUUID(); TimeUUIDType.instance.validate(ByteBuffer.wrap(UUIDGen.decompose(uuid))); } - - @Test + + @Test public void testValidTimeUUID() { TimeUUIDType.instance.validate(ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes())); } - + @Test public void testLong() { LongType.instance.validate(Util.getBytes(5L)); LongType.instance.validate(Util.getBytes(5555555555555555555L)); } - + @Test public void testInt() { Int32Type.instance.validate(Util.getBytes(5)); Int32Type.instance.validate(Util.getBytes(2057022603)); } - + @Test public void testValidUtf8() throws UnsupportedEncodingException { @@ -83,46 +83,46 @@ public class TypeValidationTest byte[] arr = s.getBytes("UTF8"); ByteBuffer buf = ByteBuffer.wrap(arr); UTF8Type.instance.validate(buf); - + // some you might not expect. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {})); // valid Utf8, unspecified in modified utf8. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {0})); - + // modified utf8 null. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {99, (byte)0xc0, (byte)0x80, 112})); - + // edges, for my sanity. UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xc2, (byte)0x81})); UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xe0, (byte)0xa0, (byte)0x81})); UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xf0, (byte)0x90, (byte)0x81, (byte)0x81})); } - + // now test for bogies. - + @Test(expected = MarshalException.class) public void testFloatingc0() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {99, (byte)0xc0, 112})); } - + @Test(expected = MarshalException.class) public void testInvalid2nd() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xc2, (byte)0xff})); } - + @Test(expected = MarshalException.class) public void testInvalid3rd() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xe0, (byte)0xa0, (byte)0xff})); } - + @Test(expected = MarshalException.class) public void testInvalid4th() { UTF8Type.instance.validate(ByteBuffer.wrap(new byte[] {(byte)0xf0, (byte)0x90, (byte)0x81, (byte)0xff})); } - + // todo: for completeness, should test invalid two byte pairs. } diff --git a/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java b/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java index 2abb408c1e..0f75d2a2f4 100644 --- a/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java +++ b/test/unit/org/apache/cassandra/db/marshal/UUIDTypeTest.java @@ -1,7 +1,7 @@ package org.apache.cassandra.db.marshal; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -9,16 +9,16 @@ package org.apache.cassandra.db.marshal; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import static org.junit.Assert.assertEquals; diff --git a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java index 72e5bf97d1..4b3a00d371 100644 --- a/test/unit/org/apache/cassandra/dht/BootStrapperTest.java +++ b/test/unit/org/apache/cassandra/dht/BootStrapperTest.java @@ -51,30 +51,30 @@ public class BootStrapperTest extends CleanupHelper // fetch a bootstrap token from the local node assert BootStrapper.getBootstrapTokenFrom(FBUtilities.getBroadcastAddress()) != null; } - + @Test public void testMulitipleAutomaticBootstraps() throws IOException { StorageService ss = StorageService.instance; generateFakeEndpoints(5); - InetAddress[] addrs = new InetAddress[] + InetAddress[] addrs = new InetAddress[] { - InetAddress.getByName("127.0.0.2"), - InetAddress.getByName("127.0.0.3"), - InetAddress.getByName("127.0.0.4"), - InetAddress.getByName("127.0.0.5"), + InetAddress.getByName("127.0.0.2"), + InetAddress.getByName("127.0.0.3"), + InetAddress.getByName("127.0.0.4"), + InetAddress.getByName("127.0.0.5"), }; InetAddress[] bootstrapAddrs = new InetAddress[] { - InetAddress.getByName("127.0.0.12"), - InetAddress.getByName("127.0.0.13"), - InetAddress.getByName("127.0.0.14"), - InetAddress.getByName("127.0.0.15"), + InetAddress.getByName("127.0.0.12"), + InetAddress.getByName("127.0.0.13"), + InetAddress.getByName("127.0.0.14"), + InetAddress.getByName("127.0.0.15"), }; Map load = new HashMap(); for (int i = 0; i < addrs.length; i++) load.put(addrs[i], (double)i+2); - + // give every node a bootstrap source. for (int i = 3; i >=0; i--) { @@ -82,24 +82,24 @@ public class BootStrapperTest extends CleanupHelper assert bootstrapSource != null; assert bootstrapSource.equals(addrs[i]) : String.format("expected %s but got %s for %d", addrs[i], bootstrapSource, i); assert !ss.getTokenMetadata().getBootstrapTokens().containsValue(bootstrapSource); - + Range range = ss.getPrimaryRangeForEndpoint(bootstrapSource); Token token = StorageService.getPartitioner().midpoint(range.left, range.right); assert range.contains(token); ss.onChange(bootstrapAddrs[i], ApplicationState.STATUS, StorageService.instance.valueFactory.bootstrapping(token)); } - + // any further attempt to bootsrtap should fail since every node in the cluster is splitting. try { BootStrapper.getBootstrapSource(ss.getTokenMetadata(), load); throw new AssertionError("This bootstrap should have failed."); } - catch (RuntimeException ex) + catch (RuntimeException ex) { // success! } - + // indicate that one of the nodes is done. see if the node it was bootstrapping from is still available. Range range = ss.getPrimaryRangeForEndpoint(addrs[2]); Token token = StorageService.getPartitioner().midpoint(range.left, range.right); diff --git a/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java b/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java index 26708bcbfb..13b052d3bc 100644 --- a/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java +++ b/test/unit/org/apache/cassandra/dht/PartitionerTestCase.java @@ -86,7 +86,7 @@ public abstract class PartitionerTestCase @Test public void testMidpointMinimum() { - T mintoken = partitioner.getMinimumToken(); + T mintoken = partitioner.getMinimumToken(); assert mintoken.compareTo(partitioner.midpoint(mintoken, mintoken)) != 0; assertMidpoint(mintoken, tok("a"), 16); assertMidpoint(mintoken, tok("aaa"), 16); @@ -100,14 +100,14 @@ public abstract class PartitionerTestCase assertMidpoint(tok("b"), tok("a"), 16); assertMidpoint(tok("bbb"), tok("a"), 16); } - + @Test public void testTokenFactoryBytes() { Token.TokenFactory factory = partitioner.getTokenFactory(); assert tok("a").compareTo(factory.fromByteArray(factory.toByteArray(tok("a")))) == 0; } - + @Test public void testTokenFactoryStrings() { diff --git a/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java b/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java index 0426a1a30a..be5e3659f5 100644 --- a/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java +++ b/test/unit/org/apache/cassandra/dht/RandomPartitionerTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.dht; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.dht; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java b/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java index 0b38058433..277cae191e 100644 --- a/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java +++ b/test/unit/org/apache/cassandra/gms/ArrivalWindowTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -27,7 +27,7 @@ import org.junit.Test; public class ArrivalWindowTest { - + @Test public void test() { @@ -41,7 +41,7 @@ public class ArrivalWindowTest //all good assertEquals(0.4342, window.phi(666), 0.01); - + //oh noes, a much higher timestamp, something went wrong! assertEquals(9.566, window.phi(3000), 0.01); } diff --git a/test/unit/org/apache/cassandra/gms/GossipDigestTest.java b/test/unit/org/apache/cassandra/gms/GossipDigestTest.java index df2f591aed..7732a0ea47 100644 --- a/test/unit/org/apache/cassandra/gms/GossipDigestTest.java +++ b/test/unit/org/apache/cassandra/gms/GossipDigestTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -46,11 +46,11 @@ public class GossipDigestTest assertEquals(endpoint, expected.getEndpoint()); assertEquals(generation, expected.getGeneration()); assertEquals(maxVersion, expected.getMaxVersion()); - + //test the serialization and equals DataOutputBuffer output = new DataOutputBuffer(); GossipDigest.serializer().serialize(expected, output, MessagingService.version_); - + ByteArrayInputStream input = new ByteArrayInputStream(output.getData(), 0, output.getLength()); GossipDigest actual = GossipDigest.serializer().deserialize(new DataInputStream(input), MessagingService.version_); assertEquals(0, expected.compareTo(actual)); diff --git a/test/unit/org/apache/cassandra/gms/SerializationsTest.java b/test/unit/org/apache/cassandra/gms/SerializationsTest.java index b61c38a2e5..0010465144 100644 --- a/test/unit/org/apache/cassandra/gms/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/gms/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.gms; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.gms; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -37,7 +37,7 @@ import java.util.Map; public class SerializationsTest extends AbstractSerializationsTester { - private void testEndpointStateWrite() throws IOException + private void testEndpointStateWrite() throws IOException { DataOutputStream out = getOutput("gms.EndpointState.bin"); HeartBeatState.serializer().serialize(Statics.HeartbeatSt, out, getVersion()); @@ -46,13 +46,13 @@ public class SerializationsTest extends AbstractSerializationsTester VersionedValue.serializer.serialize(Statics.vv1, out, getVersion()); out.close(); } - + @Test public void testEndpointStateRead() throws IOException { if (EXECUTE_WRITES) testEndpointStateWrite(); - + DataInputStream in = getInput("gms.EndpointState.bin"); assert HeartBeatState.serializer().deserialize(in, getVersion()) != null; assert EndpointState.serializer().deserialize(in, getVersion()) != null; @@ -60,7 +60,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert VersionedValue.serializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testGossipDigestWrite() throws IOException { Map states = new HashMap(); @@ -69,7 +69,7 @@ public class SerializationsTest extends AbstractSerializationsTester GossipDigestAckMessage ack = new GossipDigestAckMessage(Statics.Digests, states); GossipDigestAck2Message ack2 = new GossipDigestAck2Message(states); GossipDigestSynMessage syn = new GossipDigestSynMessage("Not a real cluster name", Statics.Digests); - + DataOutputStream out = getOutput("gms.Gossip.bin"); for (GossipDigest gd : Statics.Digests) GossipDigest.serializer().serialize(gd, out, getVersion()); @@ -78,13 +78,13 @@ public class SerializationsTest extends AbstractSerializationsTester GossipDigestSynMessage.serializer().serialize(syn, out, getVersion()); out.close(); } - + @Test public void testGossipDigestRead() throws IOException { if (EXECUTE_WRITES) testGossipDigestWrite(); - + int count = 0; DataInputStream in = getInput("gms.Gossip.bin"); while (count < Statics.Digests.size()) @@ -94,7 +94,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert GossipDigestSynMessage.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private static class Statics { private static HeartBeatState HeartbeatSt = new HeartBeatState(101, 201); @@ -103,7 +103,7 @@ public class SerializationsTest extends AbstractSerializationsTester private static VersionedValue vv0 = vvFact.load(23d); private static VersionedValue vv1 = vvFact.bootstrapping(StorageService.getPartitioner().getRandomToken()); private static List Digests = new ArrayList(); - + { HeartbeatSt.updateHeartBeat(); EndpointSt.addApplicationState(ApplicationState.LOAD, vv0); diff --git a/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java b/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java index ffe0aa6da1..d4261bf56d 100644 --- a/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java +++ b/test/unit/org/apache/cassandra/hadoop/ColumnFamilyInputFormatTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.hadoop; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.hadoop; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java b/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java index 29a1588bdb..6bc3032549 100644 --- a/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java +++ b/test/unit/org/apache/cassandra/io/BloomFilterTrackerTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java index befb0d159e..64d3980ecb 100644 --- a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java +++ b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -37,7 +37,7 @@ public class CompactSerializerTest extends CleanupHelper { private static Set expectedClassNames; private static List discoveredClassNames; - + @BeforeClass public static void scanClasspath() { @@ -71,14 +71,14 @@ public class CompactSerializerTest extends CleanupHelper expectedClassNames.add("StreamingRepairTaskSerializer"); expectedClassNames.add("AbstractBoundsSerializer"); expectedClassNames.add("SnapshotCommandSerializer"); - + discoveredClassNames = new ArrayList(); String cp = System.getProperty("java.class.path"); assert cp != null; String[] parts = cp.split(File.pathSeparator, -1); - class DirScanner + class DirScanner { - void scan(File f, String ctx) + void scan(File f, String ctx) { String newCtx = ctx == null ? f.getName().equals("org") ? f.getName() : null : ctx + "." + f.getName(); if (f.isDirectory()) @@ -114,14 +114,14 @@ public class CompactSerializerTest extends CleanupHelper cls = cls.getSuperclass(); } } - catch (ClassNotFoundException ex) + catch (ClassNotFoundException ex) { throw new RuntimeException(ex); } } } } - + DirScanner dirScanner = new DirScanner(); for (String cpItem : parts) { @@ -130,7 +130,7 @@ public class CompactSerializerTest extends CleanupHelper dirScanner.scan(f, null); } } - + /** look for classes I expect to find. */ @Test public void verifyAllSimpleNamesTest() @@ -138,7 +138,7 @@ public class CompactSerializerTest extends CleanupHelper for (String clsName : expectedClassNames) assert discoveredClassNames.contains(clsName) : clsName + " was not discovered"; } - + /** look for classes I do not expect to find. */ @Test public void noOthersTest() diff --git a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java index 65b2e7e068..1eab8c57e1 100644 --- a/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java +++ b/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/io/sstable/DescriptorTest.java b/test/unit/org/apache/cassandra/io/sstable/DescriptorTest.java index d0568a5046..98b806c1ec 100644 --- a/test/unit/org/apache/cassandra/io/sstable/DescriptorTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/DescriptorTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java index bcb761b32d..e7ea9d952a 100644 --- a/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.io.sstable; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.io.sstable; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java b/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java index fad5e9ea74..a72069a856 100644 --- a/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java +++ b/test/unit/org/apache/cassandra/locator/EC2SnitchTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.locator; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.locator; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -57,15 +57,15 @@ public class EC2SnitchTest Ec2Snitch snitch = new TestEC2Snitch(); InetAddress local = InetAddress.getByName("127.0.0.1"); InetAddress nonlocal = InetAddress.getByName("127.0.0.7"); - + Gossiper.instance.addSavedEndpoint(nonlocal); Map stateMap = Gossiper.instance.getEndpointStateForEndpoint(nonlocal).getApplicationStateMap(); stateMap.put(ApplicationState.DC, StorageService.instance.valueFactory.datacenter("us-west")); stateMap.put(ApplicationState.RACK, StorageService.instance.valueFactory.datacenter("1a")); - + assertEquals("us-west", snitch.getDatacenter(nonlocal)); assertEquals("1a", snitch.getRack(nonlocal)); - + assertEquals("us-east", snitch.getDatacenter(local)); assertEquals("1d", snitch.getRack(local)); } diff --git a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java index 78f9022d9c..027469f9d1 100644 --- a/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java +++ b/test/unit/org/apache/cassandra/locator/SimpleStrategyTest.java @@ -103,7 +103,7 @@ public class SimpleStrategyTest extends CleanupHelper } } } - + @Test public void testGetEndpointsDuringBootstrap() throws UnknownHostException, ConfigurationException { @@ -114,13 +114,13 @@ public class SimpleStrategyTest extends CleanupHelper Token[] endpointTokens = new Token[RING_SIZE]; Token[] keyTokens = new Token[RING_SIZE]; - + for (int i = 0; i < RING_SIZE; i++) { endpointTokens[i] = new BigIntegerToken(String.valueOf(RING_SIZE * 2 * i)); keyTokens[i] = new BigIntegerToken(String.valueOf(RING_SIZE * 2 * i + RING_SIZE)); } - + List hosts = new ArrayList(); for (int i = 0; i < endpointTokens.length; i++) { diff --git a/test/unit/org/apache/cassandra/net/MessageSerializer.java b/test/unit/org/apache/cassandra/net/MessageSerializer.java index f14200ae9e..8efb51e957 100644 --- a/test/unit/org/apache/cassandra/net/MessageSerializer.java +++ b/test/unit/org/apache/cassandra/net/MessageSerializer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.net; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.net; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java index d00f025d6a..af876fc289 100644 --- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java +++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceCounterTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.List; diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java index 1feac41634..f419c372b8 100644 --- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java +++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceStandardTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ import java.util.List; diff --git a/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java b/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java index 7eb48428fa..63cc4d7262 100644 --- a/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java +++ b/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java @@ -130,7 +130,7 @@ public abstract class AntiEntropyServiceTestAbstract extends CleanupHelper // and confirm that the tree was split assertTrue(validator.tree.size() > 1); } - + @Test public void testValidatorComplete() throws Throwable { @@ -231,7 +231,7 @@ public abstract class AntiEntropyServiceTestAbstract extends CleanupHelper AntiEntropyService.TreeResponse r2 = new AntiEntropyService.TreeResponse(REMOTE, rtree); AntiEntropyService.RepairSession.Differencer diff = sess.session.new Differencer(cfname, r1, r2); diff.run(); - + // ensure that the changed range was recorded assertEquals("Wrong differing ranges", interesting, new HashSet(diff.differences)); } @@ -259,7 +259,7 @@ public abstract class AntiEntropyServiceTestAbstract extends CleanupHelper return true; } }; - + // send two tasks through the stage: one to follow existing tasks and a second to follow tasks created by // those existing tasks: tasks won't recursively create more tasks stage.submit(noop).get(5000, TimeUnit.MILLISECONDS); diff --git a/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java b/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java index 44fb099d65..255fe13348 100644 --- a/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java +++ b/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java @@ -77,7 +77,7 @@ public class EmbeddedCassandraServiceTest extends CleanupHelper client.set_keyspace("Keyspace1"); ByteBuffer key_user_id = ByteBufferUtil.bytes("1"); - + long timestamp = System.currentTimeMillis(); ColumnPath cp = new ColumnPath("Standard1"); ColumnParent par = new ColumnParent("Standard1"); diff --git a/test/unit/org/apache/cassandra/service/InitClientTest.java b/test/unit/org/apache/cassandra/service/InitClientTest.java index 0047efe802..a248ca723a 100644 --- a/test/unit/org/apache/cassandra/service/InitClientTest.java +++ b/test/unit/org/apache/cassandra/service/InitClientTest.java @@ -14,7 +14,7 @@ import org.apache.cassandra.config.ConfigurationException; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software diff --git a/test/unit/org/apache/cassandra/service/RowResolverTest.java b/test/unit/org/apache/cassandra/service/RowResolverTest.java index fdf7ad49d8..caacfa0689 100644 --- a/test/unit/org/apache/cassandra/service/RowResolverTest.java +++ b/test/unit/org/apache/cassandra/service/RowResolverTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/service/SerializationsTest.java b/test/unit/org/apache/cassandra/service/SerializationsTest.java index 5ee32d5c04..88de57196a 100644 --- a/test/unit/org/apache/cassandra/service/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/service/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.service; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.service; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -51,19 +51,19 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(AntiEntropyService.TreeRequestVerbHandler.makeVerb(Statics.req, getVersion()), out, getVersion()); out.close(); } - + @Test public void testTreeRequestRead() throws IOException { if (EXECUTE_WRITES) testTreeRequestWrite(); - + DataInputStream in = getInput("service.TreeRequest.bin"); assert AntiEntropyService.TreeRequestVerbHandler.SERIALIZER.deserialize(in, getVersion()) != null; assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private void testTreeResponseWrite() throws IOException { AntiEntropyService.Validator v0 = new AntiEntropyService.Validator(Statics.req); @@ -84,13 +84,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(AntiEntropyService.TreeResponseVerbHandler.makeVerb(FBUtilities.getBroadcastAddress(), v1), out, getVersion()); out.close(); } - + @Test public void testTreeResponseRead() throws IOException { if (EXECUTE_WRITES) testTreeResponseWrite(); - + DataInputStream in = getInput("service.TreeResponse.bin"); assert AntiEntropyService.TreeResponseVerbHandler.SERIALIZER.deserialize(in, getVersion()) != null; assert AntiEntropyService.TreeResponseVerbHandler.SERIALIZER.deserialize(in, getVersion()) != null; @@ -98,7 +98,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private static class Statics { private static final AntiEntropyService.CFPair pair = new AntiEntropyService.CFPair("Keyspace1", "Standard1"); diff --git a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java index fe6becfe87..0701f5cc49 100644 --- a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.streaming; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.streaming; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -65,13 +65,13 @@ public class SerializationsTest extends AbstractSerializationsTester PendingFile.serializer().serialize(null, out, getVersion()); out.close(); } - + @Test public void testPendingFileRead() throws IOException { if (EXECUTE_WRITES) testPendingFileWrite(); - + DataInputStream in = getInput("streaming.PendingFile.bin"); assert PendingFile.serializer().deserialize(in, getVersion()) != null; assert PendingFile.serializer().deserialize(in, getVersion()) != null; @@ -79,7 +79,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert PendingFile.serializer().deserialize(in, getVersion()) == null; in.close(); } - + private void testStreamHeaderWrite() throws IOException { StreamHeader sh0 = new StreamHeader("Keyspace1", 123L, makePendingFile(true, 100, OperationType.BOOTSTRAP)); @@ -99,13 +99,13 @@ public class SerializationsTest extends AbstractSerializationsTester StreamHeader.serializer().serialize(sh4, out, getVersion()); out.close(); } - + @Test public void testStreamHeaderRead() throws IOException { if (EXECUTE_WRITES) testStreamHeaderWrite(); - + DataInputStream in = getInput("streaming.StreamHeader.bin"); assert StreamHeader.serializer().deserialize(in, getVersion()) != null; assert StreamHeader.serializer().deserialize(in, getVersion()) != null; @@ -114,7 +114,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert StreamHeader.serializer().deserialize(in, getVersion()) != null; in.close(); } - + private void testStreamReplyWrite() throws IOException { StreamReply rep = new StreamReply("this is a file", 123L, StreamReply.Status.FILE_FINISHED); @@ -123,19 +123,19 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(rep.getMessage(getVersion()), out, getVersion()); out.close(); } - + @Test public void testStreamReplyRead() throws IOException { if (EXECUTE_WRITES) testStreamReplyWrite(); - + DataInputStream in = getInput("streaming.StreamReply.bin"); assert StreamReply.serializer.deserialize(in, getVersion()) != null; assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private static PendingFile makePendingFile(boolean sst, int numSecs, OperationType op) { Descriptor desc = new Descriptor("z", new File("path/doesn't/matter"), "Keyspace1", "Standard1", 23, false); @@ -144,7 +144,7 @@ public class SerializationsTest extends AbstractSerializationsTester sections.add(new Pair(new Long(i), new Long(i * i))); return new PendingFile(sst ? makeSSTable() : null, desc, SSTable.COMPONENT_DATA, sections, op); } - + private void testStreamRequestMessageWrite() throws IOException { Collection> ranges = new ArrayList>(); @@ -164,13 +164,13 @@ public class SerializationsTest extends AbstractSerializationsTester messageSerializer.serialize(msg2.getMessage(getVersion()), out, getVersion()); out.close(); } - + @Test public void testStreamRequestMessageRead() throws IOException { if (EXECUTE_WRITES) testStreamRequestMessageWrite(); - + DataInputStream in = getInput("streaming.StreamRequestMessage.bin"); assert StreamRequestMessage.serializer().deserialize(in, getVersion()) != null; assert StreamRequestMessage.serializer().deserialize(in, getVersion()) != null; @@ -180,7 +180,7 @@ public class SerializationsTest extends AbstractSerializationsTester assert messageSerializer.deserialize(in, getVersion()) != null; in.close(); } - + private static SSTableReader makeSSTable() { Table t = Table.open("Keyspace1"); @@ -192,7 +192,7 @@ public class SerializationsTest extends AbstractSerializationsTester { rm.apply(); } - catch (IOException ex) + catch (IOException ex) { throw new RuntimeException(ex); } diff --git a/test/unit/org/apache/cassandra/streaming/StreamUtil.java b/test/unit/org/apache/cassandra/streaming/StreamUtil.java index e029666b3d..dc942e2f67 100644 --- a/test/unit/org/apache/cassandra/streaming/StreamUtil.java +++ b/test/unit/org/apache/cassandra/streaming/StreamUtil.java @@ -34,7 +34,7 @@ public class StreamUtil * Takes an stream request message and creates an empty status response. Exists here because StreamRequestMessage * is package protected. */ - static public void finishStreamRequest(Message msg, InetAddress to) + static public void finishStreamRequest(Message msg, InetAddress to) { byte[] body = msg.getMessageBody(); ByteArrayInputStream bufIn = new ByteArrayInputStream(body); @@ -47,7 +47,7 @@ public class StreamUtil } catch (Exception e) { - System.err.println(e); + System.err.println(e); e.printStackTrace(); } } diff --git a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java index 130b8c83d1..6d720a18ed 100644 --- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java +++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java @@ -104,7 +104,7 @@ public class StreamingTransferTest extends CleanupHelper // and that the max timestamp for the file was rediscovered assertEquals(timestamp, cfs.getSSTables().iterator().next().getMaxTimestamp()); - + List keys = new ArrayList(); for (int off : offs) keys.add("key" + off); @@ -129,7 +129,7 @@ public class StreamingTransferTest extends CleanupHelper { final Table table = Table.open("Keyspace1"); final ColumnFamilyStore cfs = table.getColumnFamilyStore("Indexed1"); - + List keys = createAndTransfer(table, cfs, new Mutator() { public void mutate(String key, String col, long timestamp) throws Exception @@ -167,7 +167,7 @@ public class StreamingTransferTest extends CleanupHelper { final Table table = Table.open("Keyspace1"); final ColumnFamilyStore cfs = table.getColumnFamilyStore("Super1"); - + createAndTransfer(table, cfs, new Mutator() { public void mutate(String key, String col, long timestamp) throws Exception @@ -185,7 +185,7 @@ public class StreamingTransferTest extends CleanupHelper final Table table = Table.open("Keyspace1"); final ColumnFamilyStore cfs = table.getColumnFamilyStore("Counter1"); final CounterContext cc = new CounterContext(); - + final Map cleanedEntries = new HashMap(); List keys = createAndTransfer(table, cfs, new Mutator() diff --git a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java index e550144b2a..2ab7202491 100644 --- a/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java +++ b/test/unit/org/apache/cassandra/thrift/ThriftValidationTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.thrift; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.thrift; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/tools/SSTableExportTest.java b/test/unit/org/apache/cassandra/tools/SSTableExportTest.java index ee24124c34..7aa43fea36 100644 --- a/test/unit/org/apache/cassandra/tools/SSTableExportTest.java +++ b/test/unit/org/apache/cassandra/tools/SSTableExportTest.java @@ -62,24 +62,24 @@ public class SSTableExportTest extends SchemaLoader File tempSS = tempSSTableFile("Keyspace1", "Standard1"); ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Standard1"); SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2); - + // Add rowA cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), System.currentTimeMillis()); writer.append(Util.dk("rowA"), cfamily); cfamily.clear(); - + // Add rowB cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), System.currentTimeMillis()); writer.append(Util.dk("rowB"), cfamily); cfamily.clear(); - + writer.closeAndOpenReader(); - + // Enumerate and verify File temp = File.createTempFile("Standard1", ".txt"); SSTableExport.enumeratekeys(writer.getFilename(), new PrintStream(temp.getPath())); - + FileReader file = new FileReader(temp); char[] buf = new char[(int) temp.length()]; file.read(buf); @@ -95,14 +95,14 @@ public class SSTableExportTest extends SchemaLoader File tempSS = tempSSTableFile("Keyspace1", "Standard1"); ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Standard1"); SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2); - + int nowInSec = (int)(System.currentTimeMillis() / 1000) + 42; //live for 42 seconds // Add rowA cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), System.currentTimeMillis()); cfamily.addColumn(null, new ExpiringColumn(ByteBufferUtil.bytes("colExp"), ByteBufferUtil.bytes("valExp"), System.currentTimeMillis(), 42, nowInSec)); writer.append(Util.dk("rowA"), cfamily); cfamily.clear(); - + // Add rowB cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), System.currentTimeMillis()); writer.append(Util.dk("rowB"), cfamily); @@ -114,13 +114,13 @@ public class SSTableExportTest extends SchemaLoader cfamily.clear(); SSTableReader reader = writer.closeAndOpenReader(); - + // Export to JSON and verify File tempJson = File.createTempFile("Standard1", ".json"); SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[]{asHex("rowExclude")}); - + JSONObject json = (JSONObject)JSONValue.parse(new FileReader(tempJson)); - + JSONArray rowA = (JSONArray)json.get(asHex("rowA")); JSONArray colA = (JSONArray)rowA.get(0); assert hexToBytes((String)colA.get(1)).equals(ByteBufferUtil.bytes("valA")); @@ -128,7 +128,7 @@ public class SSTableExportTest extends SchemaLoader JSONArray colExp = (JSONArray)rowA.get(1); assert ((Long)colExp.get(4)) == 42; assert ((Long)colExp.get(5)) == nowInSec; - + JSONArray rowB = (JSONArray)json.get(asHex("rowB")); JSONArray colB = (JSONArray)rowB.get(0); assert colB.size() == 3; @@ -143,12 +143,12 @@ public class SSTableExportTest extends SchemaLoader File tempSS = tempSSTableFile("Keyspace1", "Super4"); ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Super4"); SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2); - + // Add rowA cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superA"), ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), System.currentTimeMillis()); writer.append(Util.dk("rowA"), cfamily); cfamily.clear(); - + // Add rowB cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superB"), ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), System.currentTimeMillis()); writer.append(Util.dk("rowB"), cfamily); @@ -160,13 +160,13 @@ public class SSTableExportTest extends SchemaLoader cfamily.clear(); SSTableReader reader = writer.closeAndOpenReader(); - + // Export to JSON and verify File tempJson = File.createTempFile("Super4", ".json"); SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[]{asHex("rowExclude")}); - + JSONObject json = (JSONObject)JSONValue.parse(new FileReader(tempJson)); - + JSONObject rowA = (JSONObject)json.get(asHex("rowA")); JSONObject superA = (JSONObject)rowA.get(cfamily.getComparator().getString(ByteBufferUtil.bytes("superA"))); JSONArray subColumns = (JSONArray)superA.get("subColumns"); @@ -176,14 +176,14 @@ public class SSTableExportTest extends SchemaLoader assert colA.size() == 3; assert rowExclude == null; } - + @Test public void testRoundTripStandardCf() throws IOException, ParseException { File tempSS = tempSSTableFile("Keyspace1", "Standard1"); ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "Standard1"); SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2); - + // Add rowA cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("name")), ByteBufferUtil.bytes("val"), System.currentTimeMillis()); writer.append(Util.dk("rowA"), cfamily); @@ -195,11 +195,11 @@ public class SSTableExportTest extends SchemaLoader cfamily.clear(); SSTableReader reader = writer.closeAndOpenReader(); - + // Export to JSON and verify File tempJson = File.createTempFile("Standard1", ".json"); SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[]{asHex("rowExclude")}); - + // Import JSON to another SSTable file File tempSS2 = tempSSTableFile("Keyspace1", "Standard1"); SSTableImport.importJson(tempJson.getPath(), "Keyspace1", "Standard1", tempSS2.getPath()); diff --git a/test/unit/org/apache/cassandra/tools/SSTableImportTest.java b/test/unit/org/apache/cassandra/tools/SSTableImportTest.java index 7478350ac4..50d62055a0 100644 --- a/test/unit/org/apache/cassandra/tools/SSTableImportTest.java +++ b/test/unit/org/apache/cassandra/tools/SSTableImportTest.java @@ -50,7 +50,7 @@ import org.json.simple.parser.ParseException; import org.junit.Test; public class SSTableImportTest extends SchemaLoader -{ +{ @Test public void testImportSimpleCf() throws IOException, URISyntaxException { @@ -108,7 +108,7 @@ public class SSTableImportTest extends SchemaLoader String jsonUrl = resourcePath("SuperCF.json"); File tempSS = tempSSTableFile("Keyspace1", "Super4"); SSTableImport.importJson(jsonUrl, "Keyspace1", "Super4", tempSS.getPath()); - + // Verify results SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath())); QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Super4", null, null), ByteBufferUtil.bytes("superA")); diff --git a/test/unit/org/apache/cassandra/utils/BoundedStatsDequeTest.java b/test/unit/org/apache/cassandra/utils/BoundedStatsDequeTest.java index 9ead13ce02..fabb462210 100644 --- a/test/unit/org/apache/cassandra/utils/BoundedStatsDequeTest.java +++ b/test/unit/org/apache/cassandra/utils/BoundedStatsDequeTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -34,7 +34,7 @@ public class BoundedStatsDequeTest public void test() { int size = 4; - + BoundedStatsDeque bsd = new BoundedStatsDeque(size); //check the values for an empty result assertEquals(0, bsd.size()); @@ -43,13 +43,13 @@ public class BoundedStatsDequeTest assertEquals(Double.NaN, bsd.variance(), 0.001d); assertEquals(Double.NaN, bsd.stdev(), 0.001d); assertEquals(0, bsd.sumOfDeviations(), 0.001d); - + bsd.add(1d); //this one falls out, over limit bsd.add(2d); bsd.add(3d); bsd.add(4d); bsd.add(5d); - + //verify that everything is in there Iterator iter = bsd.iterator(); assertTrue(iter.hasNext()); @@ -61,7 +61,7 @@ public class BoundedStatsDequeTest assertTrue(iter.hasNext()); assertEquals(5d, iter.next(), 0); assertFalse(iter.hasNext()); - + //check results assertEquals(size, bsd.size()); assertEquals(14, bsd.sum(), 0.001d); @@ -69,7 +69,7 @@ public class BoundedStatsDequeTest assertEquals(1.25, bsd.variance(), 0.001d); assertEquals(1.1180d, bsd.stdev(), 0.001d); assertEquals(5, bsd.sumOfDeviations(), 0.001d); - + //check that it clears properly bsd.clear(); assertFalse(bsd.iterator().hasNext()); diff --git a/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java b/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java index 67dd0acc25..31b1075b49 100644 --- a/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java +++ b/test/unit/org/apache/cassandra/utils/FBUtilitiesTest.java @@ -30,7 +30,7 @@ import com.google.common.base.Charsets; import com.google.common.primitives.Ints; import org.junit.Test; -public class FBUtilitiesTest +public class FBUtilitiesTest { @Test public void testCompareByteSubArrays() @@ -78,5 +78,5 @@ public class FBUtilitiesTest { ByteBuffer bytes = ByteBuffer.wrap(new byte[]{(byte)0xff, (byte)0xfe}); ByteBufferUtil.string(bytes, Charsets.UTF_8); - } + } } diff --git a/test/unit/org/apache/cassandra/utils/HexTest.java b/test/unit/org/apache/cassandra/utils/HexTest.java index ece4be5a2a..ad64668603 100644 --- a/test/unit/org/apache/cassandra/utils/HexTest.java +++ b/test/unit/org/apache/cassandra/utils/HexTest.java @@ -58,7 +58,7 @@ public class HexTest new byte[] { 0x0f }, new byte[] { (byte)0x000000ff } }; - + for (int i = 0; i < values.length; i++) assert Arrays.equals(Hex.hexToBytes(values[i]), expected[i]); } diff --git a/test/unit/org/apache/cassandra/utils/IntervalTest.java b/test/unit/org/apache/cassandra/utils/IntervalTest.java index ac2a1bf903..bce4e37bb8 100644 --- a/test/unit/org/apache/cassandra/utils/IntervalTest.java +++ b/test/unit/org/apache/cassandra/utils/IntervalTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/utils/IntervalTreeTest.java b/test/unit/org/apache/cassandra/utils/IntervalTreeTest.java index ccb5df6b42..cdf85dd5a9 100644 --- a/test/unit/org/apache/cassandra/utils/IntervalTreeTest.java +++ b/test/unit/org/apache/cassandra/utils/IntervalTreeTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/test/unit/org/apache/cassandra/utils/LegacyBloomFilterTest.java b/test/unit/org/apache/cassandra/utils/LegacyBloomFilterTest.java index 0d289c2d3b..fe52dda50d 100644 --- a/test/unit/org/apache/cassandra/utils/LegacyBloomFilterTest.java +++ b/test/unit/org/apache/cassandra/utils/LegacyBloomFilterTest.java @@ -47,7 +47,7 @@ public class LegacyBloomFilterTest ByteArrayInputStream in = new ByteArrayInputStream(out.getData(), 0, out.getLength()); LegacyBloomFilter f2 = f.serializer().deserialize(new DataInputStream(in)); - + assert f2.isPresent(ByteBufferUtil.bytes("a")); assert !f2.isPresent(ByteBufferUtil.bytes("b")); return f2; diff --git a/test/unit/org/apache/cassandra/utils/MergeIteratorTest.java b/test/unit/org/apache/cassandra/utils/MergeIteratorTest.java index 01e8c97e98..354495592b 100644 --- a/test/unit/org/apache/cassandra/utils/MergeIteratorTest.java +++ b/test/unit/org/apache/cassandra/utils/MergeIteratorTest.java @@ -55,7 +55,7 @@ public class MergeIteratorTest { concatted += value; } - + public String getReduced() { String tmp = concatted; @@ -80,13 +80,13 @@ public class MergeIteratorTest { this.iter = Arrays.asList(items).iterator(); } - + protected E computeNext() { if (!iter.hasNext()) return endOfData(); return iter.next(); } - + public void close() { assert !this.closed; diff --git a/test/unit/org/apache/cassandra/utils/MerkleTreeTest.java b/test/unit/org/apache/cassandra/utils/MerkleTreeTest.java index 911feb7819..ebb52ec841 100644 --- a/test/unit/org/apache/cassandra/utils/MerkleTreeTest.java +++ b/test/unit/org/apache/cassandra/utils/MerkleTreeTest.java @@ -147,7 +147,7 @@ public class MerkleTreeTest assertTrue(mt.split(tok(4))); assertTrue(mt.split(tok(2))); assertEquals(3, mt.size()); - + // should fail to split below hashdepth assertFalse(mt.split(tok(1))); assertEquals(3, mt.size()); @@ -163,7 +163,7 @@ public class MerkleTreeTest assertTrue(mt.split(tok(4))); assertEquals(2, mt.size()); - + // should fail to split above maxsize assertFalse(mt.split(tok(2))); assertEquals(2, mt.size()); @@ -175,7 +175,7 @@ public class MerkleTreeTest public void testInvalids() { Iterator ranges; - + // (zero, zero] ranges = mt.invalids(); assertEquals(new Range(tok(-1), tok(-1)), ranges.next()); @@ -207,10 +207,10 @@ public class MerkleTreeTest // (zero, zero] assertNull(mt.hash(range)); - + // validate the range mt.get(tok(-1)).hash(val); - + assertHashEquals(val, mt.hash(range)); } @@ -234,12 +234,12 @@ public class MerkleTreeTest assertNull(mt.hash(right)); assertNull(mt.hash(linvalid)); assertNull(mt.hash(rinvalid)); - + // validate the range mt.get(tok(2)).hash(val); mt.get(tok(4)).hash(val); mt.get(tok(-1)).hash(val); - + assertHashEquals(leftval, mt.hash(left)); assertHashEquals(partialval, mt.hash(partial)); assertHashEquals(val, mt.hash(right)); @@ -268,14 +268,14 @@ public class MerkleTreeTest assertNull(mt.hash(lchild)); assertNull(mt.hash(rchild)); assertNull(mt.hash(invalid)); - + // validate the range mt.get(tok(1)).hash(val); mt.get(tok(2)).hash(val); mt.get(tok(4)).hash(val); mt.get(tok(6)).hash(val); mt.get(tok(-1)).hash(val); - + assertHashEquals(fullval, mt.hash(full)); assertHashEquals(lchildval, mt.hash(lchild)); assertHashEquals(rchildval, mt.hash(rchild)); @@ -303,7 +303,7 @@ public class MerkleTreeTest assertNull(mt.hash(full)); assertNull(mt.hash(childfull)); assertNull(mt.hash(invalid)); - + // validate the range mt.get(tok(1)).hash(val); mt.get(tok(2)).hash(val); @@ -360,7 +360,7 @@ public class MerkleTreeTest mt.split(tok(12)); mt.split(tok(6)); mt.split(tok(10)); - + ranges = mt.invalids(); ranges.next().addAll(new HIterator(2, 4)); // (-1,4]: depth 2 ranges.next().addAll(new HIterator(6)); // (4,6] @@ -399,7 +399,7 @@ public class MerkleTreeTest Range full = new Range(tok(-1), tok(-1)); ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); - + // populate and validate the tree mt.maxsize(256); mt.init(); @@ -413,7 +413,7 @@ public class MerkleTreeTest ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); ObjectInputStream oin = new ObjectInputStream(bin); MerkleTree restored = (MerkleTree)oin.readObject(); - + // restore partitioner after serialization restored.partitioner(partitioner); restored.fullRange = fullRange(); @@ -500,12 +500,12 @@ public class MerkleTreeTest tlist.add(tok(token)); this.tokens = tlist.iterator(); } - + public HIterator(Token... tokens) { this.tokens = Arrays.asList(tokens).iterator(); } - + public RowHash computeNext() { if (tokens.hasNext()) diff --git a/test/unit/org/apache/cassandra/utils/SerializationsTest.java b/test/unit/org/apache/cassandra/utils/SerializationsTest.java index eebed99f1b..d2c85c09d3 100644 --- a/test/unit/org/apache/cassandra/utils/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/utils/SerializationsTest.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -32,7 +32,7 @@ import java.nio.ByteBuffer; public class SerializationsTest extends AbstractSerializationsTester { - + private void testBloomFilterWrite() throws IOException { BloomFilter bf = BloomFilter.getFilter(1000000, 0.0001); @@ -42,25 +42,25 @@ public class SerializationsTest extends AbstractSerializationsTester BloomFilter.serializer().serialize(bf, out); out.close(); } - + @Test public void testBloomFilterRead() throws IOException { if (EXECUTE_WRITES) testBloomFilterWrite(); - + DataInputStream in = getInput("utils.BloomFilter.bin"); assert BloomFilter.serializer().deserialize(in) != null; in.close(); } - + private void testLegacyBloomFilterWrite() throws IOException { LegacyBloomFilter a = LegacyBloomFilter.getFilter(1000000, 1000); LegacyBloomFilter b = LegacyBloomFilter.getFilter(1000000, 0.0001); for (int i = 0; i < 100; i++) { - ByteBuffer key = StorageService.getPartitioner().getTokenFactory().toByteArray(StorageService.getPartitioner().getRandomToken()); + ByteBuffer key = StorageService.getPartitioner().getTokenFactory().toByteArray(StorageService.getPartitioner().getRandomToken()); a.add(key); b.add(key); } @@ -69,18 +69,18 @@ public class SerializationsTest extends AbstractSerializationsTester LegacyBloomFilter.serializer().serialize(b, out); out.close(); } - + @Test public void testLegacyBloomFilterRead() throws IOException { if (EXECUTE_WRITES) testLegacyBloomFilterWrite(); - + DataInputStream in = getInput("utils.LegacyBloomFilter.bin"); assert LegacyBloomFilter.serializer().deserialize(in) != null; in.close(); } - + private void testEstimatedHistogramWrite() throws IOException { EstimatedHistogram hist0 = new EstimatedHistogram(); @@ -94,20 +94,20 @@ public class SerializationsTest extends AbstractSerializationsTester } data[offsets.length] = 100000; EstimatedHistogram hist2 = new EstimatedHistogram(offsets, data); - + DataOutputStream out = getOutput("utils.EstimatedHistogram.bin"); EstimatedHistogram.serializer.serialize(hist0, out); EstimatedHistogram.serializer.serialize(hist1, out); EstimatedHistogram.serializer.serialize(hist2, out); out.close(); } - + @Test public void testEstimatedHistogramRead() throws IOException { if (EXECUTE_WRITES) testEstimatedHistogramWrite(); - + DataInputStream in = getInput("utils.EstimatedHistogram.bin"); assert EstimatedHistogram.serializer.deserialize(in) != null; assert EstimatedHistogram.serializer.deserialize(in) != null; diff --git a/test/unit/org/apache/cassandra/utils/UUIDTests.java b/test/unit/org/apache/cassandra/utils/UUIDTests.java index 6d299ed365..bbfe5e1e86 100644 --- a/test/unit/org/apache/cassandra/utils/UUIDTests.java +++ b/test/unit/org/apache/cassandra/utils/UUIDTests.java @@ -1,6 +1,6 @@ package org.apache.cassandra.utils; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.utils; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -36,7 +36,7 @@ public class UUIDTests @Test public void verifyType1() throws UnknownHostException { - + UUID uuid = UUIDGen.makeType1UUIDFromHost(InetAddress.getByName("127.0.0.1")); assert uuid.version() == 1; } diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterAdder.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterAdder.java index 049bc1eac5..fa82d57d65 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterAdder.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterAdder.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterGetter.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterGetter.java index f78e177ea4..1044c6de7d 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterGetter.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlCounterGetter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlIndexedRangeSlicer.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlIndexedRangeSlicer.java index ed4ee9f2c1..8482d78ad2 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlIndexedRangeSlicer.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlIndexedRangeSlicer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlInserter.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlInserter.java index 57c74198ea..d7a7641ddb 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlInserter.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlInserter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -35,7 +35,7 @@ import org.apache.cassandra.utils.UUIDGen; public class CqlInserter extends Operation { private static List values; - + public CqlInserter(Session client, int idx) { super(client, idx); @@ -45,13 +45,13 @@ public class CqlInserter extends Operation { if (session.getColumnFamilyType() == ColumnFamilyType.Super) throw new RuntimeException("Super columns are not implemented for CQL"); - + if (values == null) values = generateValues(); - + StringBuilder query = new StringBuilder("UPDATE Standard1 USING CONSISTENCY ") .append(session.getConsistencyLevel().toString()).append(" SET "); - + for (int i = 0; i < session.getColumnsPerKey(); i++) { if (i > 0) @@ -66,10 +66,10 @@ public class CqlInserter extends Operation // Column value query.append('=').append(getQuotedCqlBlob(values.get(i % values.size()).array())); } - + String key = String.format("%0" + session.getTotalKeysLength() + "d", index); query.append(" WHERE KEY=").append(getQuotedCqlBlob(key)); - + long start = System.currentTimeMillis(); boolean success = false; diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlMultiGetter.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlMultiGetter.java index 9b516355bb..3125cffa42 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlMultiGetter.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlMultiGetter.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlRangeSlicer.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlRangeSlicer.java index 8dcecedfd2..f49c51783e 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlRangeSlicer.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlRangeSlicer.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */ @@ -43,12 +43,12 @@ public class CqlRangeSlicer extends Operation { if (session.getColumnFamilyType() == ColumnFamilyType.Super) throw new RuntimeException("Super columns are not implemented for CQL"); - + String key = String.format("%0" + session.getTotalKeysLength() + "d", index); StringBuilder query = new StringBuilder("SELECT FIRST ").append(session.getColumnsPerKey()) .append(" ''..'' FROM Standard1 USING CONSISTENCY ").append(session.getConsistencyLevel().toString()) .append(" WHERE KEY > ").append(getQuotedCqlBlob(key)); - + long startTime = System.currentTimeMillis(); boolean success = false; diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/CqlReader.java b/tools/stress/src/org/apache/cassandra/stress/operations/CqlReader.java index 6337c29430..686c394e34 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/CqlReader.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/CqlReader.java @@ -1,6 +1,6 @@ package org.apache.cassandra.stress.operations; /* - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -8,16 +8,16 @@ package org.apache.cassandra.stress.operations; * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * */