You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/06/01 14:39:57 UTC
[1/2] git commit: Merge branch 'cassandra-1.1' into trunk
Updated Branches:
refs/heads/trunk 90869e251 -> 770c20127
Merge branch 'cassandra-1.1' into trunk
Conflicts:
src/java/org/apache/cassandra/service/MigrationManager.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/770c2012
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/770c2012
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/770c2012
Branch: refs/heads/trunk
Commit: 770c20127257970af8637884f7849e4eabeced3a
Parents: 90869e2 2247054
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Jun 1 14:39:32 2012 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Jun 1 14:39:32 2012 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../apache/cassandra/service/MigrationManager.java | 2 -
.../apache/cassandra/service/MigrationTask.java | 163 ++++++++-------
3 files changed, 90 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/770c2012/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/770c2012/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/MigrationManager.java
index 81af159,18ef298..cc1c136
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@@ -52,8 -60,8 +52,6 @@@ public class MigrationManager implement
{
private static final Logger logger = LoggerFactory.getLogger(MigrationManager.class);
-- // try that many times to send migration request to the node before giving up
- static final int MIGRATION_REQUEST_RETRIES = 3;
- private static final int MIGRATION_REQUEST_RETRIES = 3;
private static final ByteBuffer LAST_MIGRATION_KEY = ByteBufferUtil.bytes("Last Migration");
public void onJoin(InetAddress endpoint, EndpointState epState)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/770c2012/src/java/org/apache/cassandra/service/MigrationTask.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/MigrationTask.java
index 28945b1,0000000..7124f16
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/service/MigrationTask.java
+++ b/src/java/org/apache/cassandra/service/MigrationTask.java
@@@ -1,74 -1,0 +1,89 @@@
- /*
- * 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
- * regarding copyright ownership. The ASF 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 License for the specific language governing permissions and
- * limitations under the License.
- */
- package org.apache.cassandra.service;
-
- import java.net.InetAddress;
- import java.util.Collection;
- import java.util.concurrent.TimeUnit;
- import java.util.concurrent.TimeoutException;
-
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
-
- import org.apache.cassandra.config.DatabaseDescriptor;
- import org.apache.cassandra.db.DefsTable;
- import org.apache.cassandra.db.RowMutation;
- import org.apache.cassandra.gms.FailureDetector;
- import org.apache.cassandra.net.IAsyncResult;
- import org.apache.cassandra.net.MessageOut;
- import org.apache.cassandra.net.MessagingService;
- import org.apache.cassandra.utils.WrappedRunnable;
-
- class MigrationTask extends WrappedRunnable
- {
- private static final Logger logger = LoggerFactory.getLogger(MigrationTask.class);
-
- private final InetAddress endpoint;
-
- MigrationTask(InetAddress endpoint)
- {
- this.endpoint = endpoint;
- }
-
- public void runMayThrow() throws Exception
- {
- MessageOut message = new MessageOut(MessagingService.Verb.MIGRATION_REQUEST, null, MigrationManager.MigrationsSerializer.instance);
-
- int retries = 0;
- while (retries < MigrationManager.MIGRATION_REQUEST_RETRIES)
- {
- if (!FailureDetector.instance.isAlive(endpoint))
- {
- logger.error("Can't send migration request: node {} is down.", endpoint);
- return;
- }
-
- IAsyncResult<Collection<RowMutation>> iar = MessagingService.instance().sendRR(message, endpoint);
- try
- {
- Collection<RowMutation> schema = iar.get(DatabaseDescriptor.getRpcTimeout(), TimeUnit.MILLISECONDS);
- DefsTable.mergeSchema(schema);
- return;
- }
- catch(TimeoutException e)
- {
- retries++;
- }
- }
- }
- }
++/*
++ * 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
++ * regarding copyright ownership. The ASF 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 License for the specific language governing permissions and
++ * limitations under the License.
++ */
++package org.apache.cassandra.service;
++
++import java.io.IOException;
++import java.net.InetAddress;
++import java.util.Collection;
++import java.util.concurrent.TimeUnit;
++import java.util.concurrent.TimeoutException;
++
++import org.slf4j.Logger;
++import org.slf4j.LoggerFactory;
++
++import org.apache.cassandra.config.ConfigurationException;
++import org.apache.cassandra.config.DatabaseDescriptor;
++import org.apache.cassandra.db.DefsTable;
++import org.apache.cassandra.db.RowMutation;
++import org.apache.cassandra.gms.FailureDetector;
++import org.apache.cassandra.net.IAsyncCallback;
++import org.apache.cassandra.net.MessageIn;
++import org.apache.cassandra.net.MessageOut;
++import org.apache.cassandra.net.MessagingService;
++import org.apache.cassandra.utils.WrappedRunnable;
++
++
++class MigrationTask extends WrappedRunnable
++{
++ private static final Logger logger = LoggerFactory.getLogger(MigrationTask.class);
++
++ private final InetAddress endpoint;
++
++ MigrationTask(InetAddress endpoint)
++ {
++ this.endpoint = endpoint;
++ }
++
++ public void runMayThrow() throws Exception
++ {
++ MessageOut message = new MessageOut(MessagingService.Verb.MIGRATION_REQUEST, null, MigrationManager.MigrationsSerializer.instance);
++
++ if (!FailureDetector.instance.isAlive(endpoint))
++ {
++ logger.error("Can't send migration request: node {} is down.", endpoint);
++ return;
++ }
++
++ IAsyncCallback<Collection<RowMutation>> cb = new IAsyncCallback<Collection<RowMutation>>()
++ {
++ @Override
++ public void response(MessageIn<Collection<RowMutation>> message)
++ {
++ try
++ {
++ DefsTable.mergeSchema(message.payload);
++ }
++ catch (IOException e)
++ {
++ logger.error("IOException merging remote schema", e);
++ }
++ catch (ConfigurationException e)
++ {
++ logger.error("Configuration exception merging remote schema", e);
++ }
++ }
++
++ @Override
++ public boolean isLatencyForSnitch()
++ {
++ return false;
++ }
++ };
++ MessagingService.instance().sendRR(message, endpoint, cb);
++ }
++}