http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/flushed_component/flushed_component.9.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/flushed_component/flushed_component.9.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/flushed_component/flushed_component.9.query.sqlpp
new file mode 100644
index 0000000..a612cbb
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/flushed_component/flushed_component.9.query.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+SELECT value count(*)
+FROM Metadata.`Dataset`
+WHERE DatasetName = 'ds_1';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.1.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.1.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.1.sto.cmd
new file mode 100644
index 0000000..1947749
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.1.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc2 /addReplica 2 asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.10.post.http
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.10.post.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.10.post.http
new file mode 100644
index 0000000..a3ea801
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.10.post.http
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/admin/cluster/partition/master?partition=3&node=asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.11.pollget.http
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.11.pollget.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.11.pollget.http
new file mode 100644
index 0000000..32e2f78
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.11.pollget.http
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+//polltimeoutsecs=30
+
+/admin/cluster/summary
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.12.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.12.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.12.query.sqlpp
new file mode 100644
index 0000000..4951292
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.12.query.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+use tpch;
+
+select value count(*) from InMemoryLineItem;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.13.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.13.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.13.sto.cmd
new file mode 100644
index 0000000..1e192f4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.13.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc2 /removeReplica 2 asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.14.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.14.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.14.sto.cmd
new file mode 100644
index 0000000..530432f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.14.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc2 /removeReplica 3 asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.2.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.2.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.2.sto.cmd
new file mode 100644
index 0000000..f3810f8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.2.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc2 /addReplica 3 asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.3.pollget.http
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.3.pollget.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.3.pollget.http
new file mode 100644
index 0000000..4ea16d7
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.3.pollget.http
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+//polltimeoutsecs=30
+
+nc:asterix_nc2 /admin/storage/partition/2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.4.pollget.http
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.4.pollget.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.4.pollget.http
new file mode 100644
index 0000000..22558bc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.4.pollget.http
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+//polltimeoutsecs=30
+
+nc:asterix_nc2 /admin/storage/partition/3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.5.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.5.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.5.ddl.sqlpp
new file mode 100644
index 0000000..4dbf9e3
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.5.ddl.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+drop  dataverse tpch if exists;
+create  dataverse tpch;
+
+use tpch;
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : bigint,
+  l_partkey : bigint,
+  l_suppkey : bigint,
+  l_linenumber : bigint,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+};
+
+create dataset LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+create dataset InMemoryLineItem(LineItemType) primary key 
l_orderkey,l_linenumber;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.6.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.6.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.6.update.sqlpp
new file mode 100644
index 0000000..8962e6d
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.6.update.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+use tpch;
+
+load dataset LineItem using localfs 
((`path`=`asterix_nc1://data/tpch0.001/lineitem.tbl`),
+      (`format`=`delimited-text`),(`delimiter`=`|`));
+
+insert into InMemoryLineItem (select value ls from LineItem ls);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.7.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.7.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.7.sto.cmd
new file mode 100644
index 0000000..389cf68
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.7.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc1 /promote 2 asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.8.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.8.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.8.sto.cmd
new file mode 100644
index 0000000..257f26a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.8.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc1 /promote 3 asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.9.post.http
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.9.post.http
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.9.post.http
new file mode 100644
index 0000000..36e1d00
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/mem_component_recovery/mem_component_recovery.9.post.http
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+/admin/cluster/partition/master?partition=2&node=asterix_nc1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/metadata_failover/metadata_failover.12.sto.cmd
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/metadata_failover/metadata_failover.12.sto.cmd
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/metadata_failover/metadata_failover.12.sto.cmd
new file mode 100644
index 0000000..71621ac
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/replication/metadata_failover/metadata_failover.12.sto.cmd
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+nc:asterix_nc1 /removeReplica 0 asterix_nc2
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/replication.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/replication.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/replication.xml
index c3dfb3c..79c9f5c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/replication.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/replication.xml
@@ -29,5 +29,20 @@
         <output-dir compare="Text">metadata_failover</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="replication">
+      <compilation-unit name="bulkload">
+        <output-dir compare="Text">bulkload</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="replication">
+      <compilation-unit name="mem_component_recovery">
+        <output-dir compare="Text">mem_component_recovery</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="replication">
+      <compilation-unit name="flushed_component">
+        <output-dir compare="Text">flushed_component</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
 </test-suite>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
index 53d6563..85b121e 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm
@@ -22,14 +22,12 @@
     "metadata\.node" : "asterix_nc1",
     "metadata\.registration\.timeout\.secs" : 60,
     "replication\.enabled" : false,
-    "replication\.factor" : 3,
+    "replication\.factor" : 2,
     "replication\.log\.batchsize" : 4096,
     "replication\.log\.buffer\.numpages" : 8,
     "replication\.log\.buffer\.pagesize" : 131072,
-    "replication\.max\.remote\.recovery\.attempts" : 5,
-    "replication\.port" : 2000,
-    "replication\.strategy" : "chained_declustering",
-    "replication\.timeout" : 15,
+    "replication\.strategy" : "none",
+    "replication\.timeout" : 30,
     "txn\.commitprofiler\.enabled" : false,
     "txn\.commitprofiler\.reportinterval" : 5,
     "txn\.job\.recovery\.memorysize" : 67108864,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
index 1160758..7017b06 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm
@@ -22,14 +22,12 @@
     "metadata\.node" : "asterix_nc1",
     "metadata\.registration\.timeout\.secs" : 60,
     "replication\.enabled" : false,
-    "replication\.factor" : 3,
+    "replication\.factor" : 2,
     "replication\.log\.batchsize" : 4096,
     "replication\.log\.buffer\.numpages" : 8,
     "replication\.log\.buffer\.pagesize" : 131072,
-    "replication\.max\.remote\.recovery\.attempts" : 5,
-    "replication\.port" : 2000,
-    "replication\.strategy" : "chained_declustering",
-    "replication\.timeout" : 15,
+    "replication\.strategy" : "none",
+    "replication\.timeout" : 30,
     "txn\.commitprofiler\.enabled" : false,
     "txn\.commitprofiler\.reportinterval" : 5,
     "txn\.job\.recovery\.memorysize" : 67108864,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
index d1c9fe0..00e4d67 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm
@@ -22,14 +22,12 @@
     "metadata\.node" : "asterix_nc1",
     "metadata\.registration\.timeout\.secs" : 60,
     "replication\.enabled" : false,
-    "replication\.factor" : 3,
+    "replication\.factor" : 2,
     "replication\.log\.batchsize" : 4096,
     "replication\.log\.buffer\.numpages" : 8,
     "replication\.log\.buffer\.pagesize" : 131072,
-    "replication\.max\.remote\.recovery\.attempts" : 5,
-    "replication\.port" : 2000,
-    "replication\.strategy" : "chained_declustering",
-    "replication\.timeout" : 15,
+    "replication\.strategy" : "none",
+    "replication\.timeout" : 30,
     "txn\.commitprofiler\.enabled" : false,
     "txn\.commitprofiler\.reportinterval" : 5,
     "txn\.job\.recovery\.memorysize" : 67108864,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.10.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.10.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.10.adm
new file mode 100644
index 0000000..3a8dfe0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.10.adm
@@ -0,0 +1 @@
+6005
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.3.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.3.adm
new file mode 100644
index 0000000..a6afbb4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.3.adm
@@ -0,0 +1,7 @@
+[ {
+  "partition" : 2,
+  "replicas" : [ {
+    "location" : "127.0.0.1:2001",
+    "status" : "IN_SYNC"
+  } ]
+} ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.4.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.4.adm
new file mode 100644
index 0000000..53648a2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.4.adm
@@ -0,0 +1,7 @@
+[ {
+  "partition" : 3,
+  "replicas" : [ {
+    "location" : "127.0.0.1:2001",
+    "status" : "IN_SYNC"
+  } ]
+} ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.7.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.7.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.7.adm
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.8.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.8.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.8.adm
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.9.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.9.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.9.adm
new file mode 100644
index 0000000..c382703
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/bulkload/bulkload.9.adm
@@ -0,0 +1,38 @@
+{
+  "metadata_node" : "asterix_nc1",
+  "partitions" : {
+    "0" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 0,
+      "nodeId" : "asterix_nc1",
+      "partitionId" : 0,
+      "pendingActivation" : false
+    },
+    "1" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 1,
+      "nodeId" : "asterix_nc1",
+      "partitionId" : 1,
+      "pendingActivation" : false
+    },
+    "2" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 0,
+      "nodeId" : "asterix_nc2",
+      "partitionId" : 2,
+      "pendingActivation" : false
+    },
+    "3" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 1,
+      "nodeId" : "asterix_nc2",
+      "partitionId" : 3,
+      "pendingActivation" : false
+    }
+  },
+  "state" : "ACTIVE"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.2.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.2.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.2.adm
new file mode 100644
index 0000000..7e92c87
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.2.adm
@@ -0,0 +1,7 @@
+[ {
+  "partition" : 0,
+  "replicas" : [ {
+    "location" : "127.0.0.1:2002",
+    "status" : "IN_SYNC"
+  } ]
+} ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.4.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.4.adm
new file mode 100644
index 0000000..f84d77a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.4.adm
@@ -0,0 +1 @@
+{"keys":"DataverseName,DatasetName","type":{"type":"org.apache.asterix.om.types.ARecordType","name":"DatasetRecordType","open":true,"fields":[{"DataverseName":{"type":"AString"}},{"DatasetName":{"type":"AString"}},{"DatatypeDataverseName":{"type":"AString"}},{"DatatypeName":{"type":"AString"}},{"DatasetType":{"type":"AString"}},{"GroupName":{"type":"AString"}},{"CompactionPolicy":{"type":"AString"}},{"CompactionPolicyProperties":{"type":"org.apache.asterix.om.types.AOrderedListType","item-type":{"type":"org.apache.asterix.om.types.ARecordType","name":"DatasetRecordType_CompactionPolicyProperties_Item","open":true,"fields":[{"Name":{"type":"AString"}},{"Value":{"type":"AString"}}]}}},{"InternalDetails":{"type":"org.apache.asterix.om.types.AUnionType","fields":[{"type":"org.apache.asterix.om.types.ARecordType","name":"DatasetRecordType_InternalDetails","open":true,"fields":[{"FileStructure":{"type":"AString"}},{"PartitioningStrategy":{"type":"AString"}},{"PartitioningKey":{"type":"org
 
.apache.asterix.om.types.AOrderedListType","item-type":{"type":"org.apache.asterix.om.types.AOrderedListType","item-type":{"type":"AString"}}}},{"PrimaryKey":{"type":"org.apache.asterix.om.types.AOrderedListType","item-type":{"type":"org.apache.asterix.om.types.AOrderedListType","item-type":{"type":"AString"}}}},{"Autogenerated":{"type":"ABoolean"}}]},{"type":"ANULL"},{"type":"AMISSING"}]}},{"ExternalDetails":{"type":"org.apache.asterix.om.types.AUnionType","fields":[{"type":"org.apache.asterix.om.types.ARecordType","name":"DatasetRecordType_ExternalDetails","open":true,"fields":[{"DatasourceAdapter":{"type":"AString"}},{"Properties":{"type":"org.apache.asterix.om.types.AOrderedListType","item-type":{"type":"org.apache.asterix.om.types.ARecordType","name":"DatasetRecordType_ExternalDetails_Properties_Item","open":true,"fields":[{"Name":{"type":"AString"}},{"Value":{"type":"AString"}}]}}},{"LastRefreshTime":{"type":"ADateTime"}},{"TransactionState":{"type":"AInt32"}}]},{"type":"ANULL
 
"},{"type":"AMISSING"}]}},{"Hints":{"type":"org.apache.asterix.om.types.AUnorderedListType","item-type":{"type":"org.apache.asterix.om.types.ARecordType","name":"DatasetRecordType_Hints_Item","open":true,"fields":[{"Name":{"type":"AString"}},{"Value":{"type":"AString"}}]}}},{"Timestamp":{"type":"AString"}},{"DatasetId":{"type":"AInt32"}},{"PendingOp":{"type":"AInt32"}}]},"splits":[{"ip":"127.0.0.1","path":"storage/partition_0/Metadata/Dataset/0/Dataset"}]}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.6.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.6.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.6.adm
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.7.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.7.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.7.adm
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.8.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.8.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.8.adm
new file mode 100644
index 0000000..fa5cfb4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.8.adm
@@ -0,0 +1,38 @@
+{
+  "metadata_node" : "asterix_nc2",
+  "partitions" : {
+    "0" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc2",
+      "iodeviceNum" : 0,
+      "nodeId" : "asterix_nc1",
+      "partitionId" : 0,
+      "pendingActivation" : false
+    },
+    "1" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 1,
+      "nodeId" : "asterix_nc1",
+      "partitionId" : 1,
+      "pendingActivation" : false
+    },
+    "2" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc2",
+      "iodeviceNum" : 0,
+      "nodeId" : "asterix_nc2",
+      "partitionId" : 2,
+      "pendingActivation" : false
+    },
+    "3" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc2",
+      "iodeviceNum" : 1,
+      "nodeId" : "asterix_nc2",
+      "partitionId" : 3,
+      "pendingActivation" : false
+    }
+  },
+  "state" : "ACTIVE"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.9.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.9.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.9.adm
new file mode 100644
index 0000000..56a6051
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/flushed_component/flushed_component.9.adm
@@ -0,0 +1 @@
+1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.10.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.10.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.10.adm
new file mode 100644
index 0000000..3a8dfe0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.10.adm
@@ -0,0 +1 @@
+6005
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.3.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.3.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.3.adm
new file mode 100644
index 0000000..a6afbb4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.3.adm
@@ -0,0 +1,7 @@
+[ {
+  "partition" : 2,
+  "replicas" : [ {
+    "location" : "127.0.0.1:2001",
+    "status" : "IN_SYNC"
+  } ]
+} ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.4.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.4.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.4.adm
new file mode 100644
index 0000000..53648a2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.4.adm
@@ -0,0 +1,7 @@
+[ {
+  "partition" : 3,
+  "replicas" : [ {
+    "location" : "127.0.0.1:2001",
+    "status" : "IN_SYNC"
+  } ]
+} ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.7.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.7.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.7.adm
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.8.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.8.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.8.adm
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.9.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.9.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.9.adm
new file mode 100644
index 0000000..c382703
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/mem_component_recovery/mem_component_recovery.9.adm
@@ -0,0 +1,38 @@
+{
+  "metadata_node" : "asterix_nc1",
+  "partitions" : {
+    "0" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 0,
+      "nodeId" : "asterix_nc1",
+      "partitionId" : 0,
+      "pendingActivation" : false
+    },
+    "1" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 1,
+      "nodeId" : "asterix_nc1",
+      "partitionId" : 1,
+      "pendingActivation" : false
+    },
+    "2" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 0,
+      "nodeId" : "asterix_nc2",
+      "partitionId" : 2,
+      "pendingActivation" : false
+    },
+    "3" : {
+      "active" : true,
+      "activeNodeId" : "asterix_nc1",
+      "iodeviceNum" : 1,
+      "nodeId" : "asterix_nc2",
+      "partitionId" : 3,
+      "pendingActivation" : false
+    }
+  },
+  "state" : "ACTIVE"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.11.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.11.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.11.adm
index 56a6051..d0138cb 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.11.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.11.adm
@@ -1 +1,3 @@
-1
\ No newline at end of file
+1
+
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
index 28be6fa..8a83c7b 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
@@ -24,8 +24,6 @@ import java.util.concurrent.Executor;
 
 import org.apache.asterix.common.context.IStorageComponentProvider;
 import org.apache.asterix.common.exceptions.ACIDException;
-import org.apache.asterix.common.replication.IRemoteRecoveryManager;
-import org.apache.asterix.common.replication.IReplicaResourcesManager;
 import org.apache.asterix.common.replication.IReplicationChannel;
 import org.apache.asterix.common.replication.IReplicationManager;
 import org.apache.asterix.common.storage.IIndexCheckpointManagerProvider;
@@ -80,10 +78,6 @@ public interface INcApplicationContext extends 
IApplicationContext {
 
     Object getActiveManager();
 
-    IRemoteRecoveryManager getRemoteRecoveryManager();
-
-    IReplicaResourcesManager getReplicaResourcesManager();
-
     IReplicationManager getReplicationManager();
 
     IReplicationChannel getReplicationChannel();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java
index 6e7d58b..3455774 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java
@@ -18,43 +18,34 @@
  */
 package org.apache.asterix.common.config;
 
-import java.util.List;
-import org.apache.hyracks.api.config.IApplicationConfig;
+import static org.apache.hyracks.control.common.config.OptionTypes.BOOLEAN;
+import static org.apache.hyracks.control.common.config.OptionTypes.INTEGER;
+import static 
org.apache.hyracks.control.common.config.OptionTypes.INTEGER_BYTE_UNIT;
+import static org.apache.hyracks.control.common.config.OptionTypes.LONG;
+import static org.apache.hyracks.control.common.config.OptionTypes.STRING;
+
+import java.util.concurrent.TimeUnit;
+
 import org.apache.hyracks.api.config.IOption;
 import org.apache.hyracks.api.config.IOptionType;
 import org.apache.hyracks.api.config.Section;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.control.common.controllers.NCConfig;
 import org.apache.hyracks.util.StorageUtil;
 import org.apache.hyracks.util.StorageUtil.StorageUnit;
 
-import static org.apache.hyracks.control.common.config.OptionTypes.*;
-
 public class ReplicationProperties extends AbstractProperties {
 
     public enum Option implements IOption {
-        REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS(
-                INTEGER,
-                5,
-                "The maximum number of times to attempt to recover from a 
replica on failure before giving up"),
-        REPLICATION_LOG_BUFFER_PAGESIZE(
-                INTEGER_BYTE_UNIT,
-                StorageUtil.getIntSizeInBytes(128, StorageUnit.KILOBYTE),
+        REPLICATION_LOG_BUFFER_PAGESIZE(INTEGER_BYTE_UNIT, 
StorageUtil.getIntSizeInBytes(128, StorageUnit.KILOBYTE),
                 "The size in bytes of each log buffer page"),
         REPLICATION_LOG_BUFFER_NUMPAGES(INTEGER, 8, "The number of log buffer 
pages"),
-        REPLICATION_LOG_BATCHSIZE(
-                INTEGER_BYTE_UNIT,
-                StorageUtil.getIntSizeInBytes(4, StorageUnit.KILOBYTE),
+        REPLICATION_LOG_BATCHSIZE(INTEGER_BYTE_UNIT, 
StorageUtil.getIntSizeInBytes(4, StorageUnit.KILOBYTE),
                 "The size in bytes to replicate in each batch"),
-        REPLICATION_TIMEOUT(
-                INTEGER,
-                REPLICATION_TIME_OUT_DEFAULT,
-                "The time in seconds to timeout when trying to contact a 
replica, before assuming it is dead"),
-
+        REPLICATION_TIMEOUT(LONG, TimeUnit.SECONDS.toSeconds(30),
+                "The time in seconds to timeout waiting for master or replica 
to ack"),
         REPLICATION_ENABLED(BOOLEAN, false, "Whether or not data replication 
is enabled"),
-        REPLICATION_FACTOR(INTEGER, 3, "Number of node controller faults to 
tolerate with replication"),
-        REPLICATION_STRATEGY(STRING, "chained_declustering", "Replication 
strategy to choose"),
-        REPLICATION_PORT(INTEGER, 2000, "port on which to run replication 
related communications"),;
+        REPLICATION_FACTOR(INTEGER, 2, "Number of replicas (backups) to 
maintain per master replica"),
+        REPLICATION_STRATEGY(STRING, "none", "Replication strategy to choose");
 
         private final IOptionType type;
         private final Object defaultValue;
@@ -85,40 +76,16 @@ public class ReplicationProperties extends 
AbstractProperties {
         public Object defaultValue() {
             return defaultValue;
         }
-
-        @Override
-        public Object get(IApplicationConfig config) {
-            switch (this) {
-                case REPLICATION_TIMEOUT:
-                    return REPLICATION_TIME_OUT_DEFAULT;
-                default:
-                    return config.getStatic(this);
-            }
-        }
     }
 
     public boolean isReplicationEnabled() {
         return accessor.getBoolean(Option.REPLICATION_ENABLED);
     }
 
-    private static final int REPLICATION_TIME_OUT_DEFAULT = 15;
-
-    public ReplicationProperties(PropertiesAccessor accessor) throws 
HyracksDataException {
+    public ReplicationProperties(PropertiesAccessor accessor) {
         super(accessor);
     }
 
-    public int getMaxRemoteRecoveryAttempts() {
-        return 
accessor.getInt(Option.REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS);
-    }
-
-    public int getReplicationFactor() {
-        return accessor.getInt(Option.REPLICATION_FACTOR);
-    }
-
-    public List<String> getNodeIds() {
-        return accessor.getNCNames();
-    }
-
     public int getLogBufferPageSize() {
         return accessor.getInt(Option.REPLICATION_LOG_BUFFER_PAGESIZE);
     }
@@ -131,20 +98,23 @@ public class ReplicationProperties extends 
AbstractProperties {
         return accessor.getInt(Option.REPLICATION_LOG_BATCHSIZE);
     }
 
-    public String getNodeIpFromId(String id) {
-        return 
accessor.getNCEffectiveConfig(id).getString(NCConfig.Option.PUBLIC_ADDRESS);
+    public String getReplicationAddress() {
+        return accessor.getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS);
+    }
+
+    public int getReplicationPort() {
+        return accessor.getInt(NCConfig.Option.REPLICATION_LISTEN_PORT);
     }
 
     public String getReplicationStrategy() {
         return accessor.getString(Option.REPLICATION_STRATEGY);
     }
 
-    public int getReplicationTimeOut() {
-        return accessor.getInt(Option.REPLICATION_TIMEOUT);
+    public long getReplicationTimeOut() {
+        return accessor.getLong(Option.REPLICATION_TIMEOUT);
     }
 
-    public MetadataProperties getMetadataProperties() {
-        return new MetadataProperties(accessor);
+    public int getReplicationFactor() {
+        return accessor.getInt(Option.REPLICATION_FACTOR);
     }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/AllDatasetsReplicationStrategy.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/AllDatasetsReplicationStrategy.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/AllDatasetsReplicationStrategy.java
new file mode 100644
index 0000000..9f9294b
--- /dev/null
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/AllDatasetsReplicationStrategy.java
@@ -0,0 +1,27 @@
+/*
+ * 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.asterix.common.replication;
+
+public class AllDatasetsReplicationStrategy implements IReplicationStrategy {
+
+    @Override
+    public boolean isMatch(int datasetId) {
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java
deleted file mode 100644
index 6f66599..0000000
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.asterix.common.replication;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.asterix.common.config.ReplicationProperties;
-import org.apache.hyracks.api.config.IConfigManager;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.control.common.config.ConfigManager;
-import org.apache.hyracks.control.common.controllers.NCConfig;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-public class ChainedDeclusteringReplicationStrategy implements 
IReplicationStrategy {
-
-    private static final Logger LOGGER = LogManager.getLogger();
-    private int replicationFactor;
-    private ReplicationProperties repProp;
-    private ConfigManager configManager;
-
-    @Override
-    public boolean isMatch(int datasetId) {
-        return true;
-    }
-
-    @Override
-    public Set<Replica> getRemoteReplicas(String nodeId) {
-        Set<Replica> remoteReplicas = new HashSet<>();
-        int numberOfRemoteReplicas = replicationFactor - 1;
-        int nodeIndex = repProp.getNodeIds().indexOf(nodeId);
-
-        if (nodeIndex == -1) {
-            if (LOGGER.isWarnEnabled()) {
-                LOGGER.warn("Could not find node " + nodeId + " in cluster 
configurations");
-            }
-            return Collections.emptySet();
-        }
-
-        //find nodes to the right of this node
-        while (remoteReplicas.size() != numberOfRemoteReplicas) {
-            String replica = repProp.getNodeIds().get(++nodeIndex % 
repProp.getNodeIds().size());
-            remoteReplicas.add(new Replica(replica,
-                    
configManager.getNodeEffectiveConfig(replica).getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS),
-                    
configManager.getNodeEffectiveConfig(replica).getInt(NCConfig.Option.REPLICATION_LISTEN_PORT)));
-        }
-
-        return remoteReplicas;
-    }
-
-    @Override
-    public Set<Replica> getRemoteReplicasAndSelf(String nodeId) {
-        Set<Replica> replicas = getRemoteReplicas(nodeId);
-        replicas.add(new Replica(nodeId,
-                
configManager.getNodeEffectiveConfig(nodeId).getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS),
-                
configManager.getNodeEffectiveConfig(nodeId).getInt(NCConfig.Option.REPLICATION_LISTEN_PORT)));
-        return replicas;
-
-    }
-
-    @Override
-    public Set<Replica> getRemotePrimaryReplicas(String nodeId) {
-        Set<Replica> clientReplicas = new HashSet<>();
-        final int remotePrimaryReplicasCount = replicationFactor - 1;
-        int nodeIndex = repProp.getNodeIds().indexOf(nodeId);
-
-        //find nodes to the left of this node
-        while (clientReplicas.size() != remotePrimaryReplicasCount) {
-            String replica = repProp.getNodeIds().get(Math.abs(--nodeIndex % 
repProp.getNodeIds().size()));
-            clientReplicas.add(new Replica(replica,
-                    
configManager.getNodeEffectiveConfig(replica).getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS),
-                    
configManager.getNodeEffectiveConfig(replica).getInt(NCConfig.Option.REPLICATION_LISTEN_PORT)));
-        }
-
-        return clientReplicas;
-    }
-
-    @Override
-    public ChainedDeclusteringReplicationStrategy from(ReplicationProperties 
repProp, IConfigManager configManager)
-            throws HyracksDataException {
-        ChainedDeclusteringReplicationStrategy cd = new 
ChainedDeclusteringReplicationStrategy();
-        cd.repProp = repProp;
-        cd.replicationFactor = repProp.getReplicationFactor();
-        cd.configManager = (ConfigManager) configManager;
-        return cd;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IFaultToleranceStrategy.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IFaultToleranceStrategy.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IFaultToleranceStrategy.java
index e871374..bf4cac9 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IFaultToleranceStrategy.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IFaultToleranceStrategy.java
@@ -58,11 +58,11 @@ public interface IFaultToleranceStrategy {
     /**
      * Constructs a fault tolerance strategy.
      *
-     * @param replicationStrategy
-     * @param messageBroker
-     * @return
+     * @param serviceCtx
+     * @param replicationEnabled
+     * @return the fault tolerance strategy
      */
-    IFaultToleranceStrategy from(ICCServiceContext serviceCtx, 
IReplicationStrategy replicationStrategy);
+    IFaultToleranceStrategy from(ICCServiceContext serviceCtx, boolean 
replicationEnabled);
 
     /**
      * Performs the required steps to change the metadata node to {@code node}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INCLifecycleMessage.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INCLifecycleMessage.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INCLifecycleMessage.java
index 372a88a..69432e9 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INCLifecycleMessage.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/INCLifecycleMessage.java
@@ -23,17 +23,9 @@ import org.apache.hyracks.api.messages.IMessage;
 public interface INCLifecycleMessage extends IMessage {
 
     enum MessageType {
-        REPLAY_LOGS_REQUEST,
-        REPLAY_LOGS_RESPONSE,
-        PREPARE_FAILBACK_REQUEST,
-        PREPARE_FAILBACK_RESPONSE,
-        COMPLETE_FAILBACK_REQUEST,
-        COMPLETE_FAILBACK_RESPONSE,
         REGISTRATION_TASKS_REQUEST,
         REGISTRATION_TASKS_RESPONSE,
         REGISTRATION_TASKS_RESULT,
-        TAKEOVER_PARTITION_REQUEST,
-        TAKEOVER_PARTITION_RESPONSE,
         METADATA_NODE_REQUEST,
         METADATA_NODE_RESPONSE
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IPartitionReplica.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IPartitionReplica.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IPartitionReplica.java
index 5a9dc3f..761b2c6 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IPartitionReplica.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IPartitionReplica.java
@@ -44,4 +44,11 @@ public interface IPartitionReplica {
      * @return The identifier
      */
     ReplicaIdentifier getIdentifier();
+
+    /**
+     * Notifies that failure {@code failure} occurred on this replica
+     *
+     * @param failure
+     */
+    void notifyFailure(Exception failure);
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IRemoteRecoveryManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IRemoteRecoveryManager.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IRemoteRecoveryManager.java
deleted file mode 100644
index 51b826b..0000000
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IRemoteRecoveryManager.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.asterix.common.replication;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.asterix.common.exceptions.ACIDException;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public interface IRemoteRecoveryManager {
-
-    /**
-     * Performs the partitions takeover process from the {@code failedNode}
-     *
-     * @param failedNode
-     * @param partitions
-     * @throws IOException
-     * @throws ACIDException
-     */
-    public void takeoverPartitons(Integer[] partitions) throws IOException, 
ACIDException;
-
-    /**
-     * Construct failback plan and requests LSM disk components from active 
remote replicas.
-     */
-    public void startFailbackProcess();
-
-    /**
-     * Requests the remaining LSM disk components files from active remote 
replicas.
-     *
-     * @throws IOException
-     * @throws InterruptedException
-     */
-    public void completeFailbackProcess() throws IOException, 
InterruptedException;
-
-    /**
-     * Replays all committed jobs logs for {@code partitions}. Optionally, 
flushes all datasets
-     * to convert the replayed logs into LSM Components.
-     *
-     * @param partitions
-     * @param flush
-     * @throws HyracksDataException
-     */
-    void replayReplicaPartitionLogs(Set<Integer> partitions, boolean flush) 
throws HyracksDataException;
-
-    /**
-     * Performs the remote recovery plan by requesting data from each 
specified node
-     * for each partitions specified.
-     *
-     * @param recoveryPlan
-     * @throws HyracksDataException
-     */
-    void doRemoteRecoveryPlan(Map<String, Set<Integer>> recoveryPlan) throws 
HyracksDataException;
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicaResourcesManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicaResourcesManager.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicaResourcesManager.java
deleted file mode 100644
index 72a7f9d..0000000
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicaResourcesManager.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.asterix.common.replication;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public interface IReplicaResourcesManager {
-
-    /**
-     * @param partitions
-     * @return the minimum LSN of all indexes that belong to {@code 
partitions}.
-     * @throws HyracksDataException
-     */
-    long getPartitionsMinLSN(Set<Integer> partitions) throws 
HyracksDataException;
-
-    List<String> getPartitionIndexesFiles(int partition, boolean relativePath) 
throws HyracksDataException;
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationDestination.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationDestination.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationDestination.java
new file mode 100644
index 0000000..2fe9de8
--- /dev/null
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationDestination.java
@@ -0,0 +1,60 @@
+/*
+ * 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.asterix.common.replication;
+
+import java.net.InetSocketAddress;
+import java.util.Set;
+
+public interface IReplicationDestination {
+
+    /**
+     * Adds {@code replica} to this {@link IReplicationDestination}
+     *
+     * @param replica
+     */
+    void add(IPartitionReplica replica);
+
+    /**
+     * Removes {@code replica} from this {@link IReplicationDestination}
+     *
+     * @param replica
+     */
+    void remove(IPartitionReplica replica);
+
+    /**
+     * Notifies that failure {@code failure} occurred on this {@link 
IReplicationDestination}
+     *
+     * @param failure
+     */
+    void notifyFailure(Exception failure);
+
+    /**
+     * Gets the list of replicas on this {@link IReplicationDestination}
+     *
+     * @return the list of replicas
+     */
+    Set<IPartitionReplica> getReplicas();
+
+    /**
+     * Gets the location of this {@link IReplicationDestination}
+     *
+     * @return the location
+     */
+    InetSocketAddress getLocation();
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java
index 07076cf..1da2980 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java
@@ -18,122 +18,44 @@
  */
 package org.apache.asterix.common.replication;
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Set;
-
 import org.apache.asterix.common.transactions.ILogRecord;
 import org.apache.hyracks.api.replication.IIOReplicationManager;
 
 public interface IReplicationManager extends IIOReplicationManager {
 
     /**
-     * Asynchronously sends a serialized version of the record to remote 
replicas.
-     *
-     * @param logRecord
-     *            The log record to be replicated,
-     * @throws InterruptedException
-     */
-    public void replicateLog(ILogRecord logRecord) throws InterruptedException;
-
-    /**
-     * Checks whether a log record has been replicated
-     *
-     * @param logRecord
-     *            the log to check for.
-     * @return true, if all ACKs were received from remote replicas.
-     */
-    public boolean hasBeenReplicated(ILogRecord logRecord);
-
-    /**
-     * Requests LSM components files from a remote replica.
-     *
-     * @param remoteReplicaId
-     *            The replica id to send the request to.
-     * @param partitionsToRecover
-     *            Get files that belong to those partitions.
-     * @param existingFiles
-     *            a list of already existing files on the requester
-     * @throws IOException
-     */
-    public void requestReplicaFiles(String remoteReplicaId, Set<Integer> 
partitionsToRecover, Set<String> existingFiles)
-            throws IOException;
-
-    /**
-     * Requests current maximum LSN from remote replicas.
-     *
-     * @param remoteReplicaIds
-     *            remote replicas to send the request to.
-     * @return The maximum of the received maximum LSNs.
-     * @throws IOException
-     */
-    public long getMaxRemoteLSN(Set<String> remoteReplicaIds) throws 
IOException;
-
-    /**
-     * @return The number of remote replicas that are in ACTIVE state.
-     */
-    public int getActiveReplicasCount();
-
-    /**
-     * @return The IDs of the remote replicas that are in DEAD state.
-     */
-    public Set<String> getDeadReplicasIds();
-
-    /**
-     * Starts processing of ASYNC replication jobs as well as Txn logs.
+     * Registers {@code replica}. After registration, the replica will be 
included in all replication events
      *
-     * @throws InterruptedException
-     */
-    public void startReplicationThreads() throws InterruptedException;
-
-    /**
-     * Checks and sets each remote replica state.
+     * @param replica
      */
-    public void initializeReplicasState();
+    void register(IPartitionReplica replica);
 
     /**
-     * Updates remote replica (in-memory) information.
+     * Unregisters {@code replica} from replication events.
      *
      * @param replica
-     *            the replica to update.
-     */
-    public void updateReplicaInfo(Replica replica);
-
-    /**
-     * @return The IDs of the remote replicas that are in ACTIVE state.
      */
-    public Set<String> getActiveReplicasIds();
+    void unregister(IPartitionReplica replica);
 
     /**
-     * Submits a ReplicaEvent to ReplicationEventsMonitor thread.
+     * Notifies that failure {@code failure} occurred on {@code dest}
      *
-     * @param event
+     * @param dest
+     * @param failure
      */
-    public void reportReplicaEvent(ReplicaEvent event);
+    void notifyFailure(IReplicationDestination dest, Exception failure);
 
     /**
-     * Sends a request to remote replicas to flush indexes that have LSN less 
than nonSharpCheckpointTargetLSN
+     * Asynchronously sends a serialized version of the record to remote 
replicas.
      *
-     * @param nonSharpCheckpointTargetLSN
-     * @throws IOException
+     * @param logRecord The log record to be replicated
+     * @throws InterruptedException
      */
-    public void requestFlushLaggingReplicaIndexes(long 
nonSharpCheckpointTargetLSN) throws IOException;
+    void replicate(ILogRecord logRecord) throws InterruptedException;
 
     /**
-     * Transfers the contents of the {@code buffer} to active remote replicas.
-     * The transfer starts from the {@code buffer} current position to its 
limit.
-     * After the transfer, the {@code buffer} position will be its limit.
-     *
-     * @param buffer
+     * @return the replication strategy
      */
-    public void replicateTxnLogBatch(ByteBuffer buffer);
-
     IReplicationStrategy getReplicationStrategy();
 
-    /**
-     * Registers {@code replica}. After registration, the replica will be 
included in all replication events
-     *
-     * @param replica
-     */
-    void register(IPartitionReplica replica);
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java
index 93ccfbe..0ad8be2 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java
@@ -18,12 +18,6 @@
  */
 package org.apache.asterix.common.replication;
 
-import java.util.Set;
-
-import org.apache.asterix.common.config.ReplicationProperties;
-import org.apache.hyracks.api.config.IConfigManager;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
 public interface IReplicationStrategy {
 
     /**
@@ -31,32 +25,4 @@ public interface IReplicationStrategy {
      * @return True, if the dataset should be replicated. Otherwise false.
      */
     boolean isMatch(int datasetId);
-
-    Set<Replica> getRemoteReplicasAndSelf(String nodeId);
-
-    /**
-     * @param nodeId
-     * @return The set of nodes that replicate data on {@code nodeId}.
-     */
-    Set<Replica> getRemotePrimaryReplicas(String nodeId);
-
-    /**
-     * @param node
-     * @return The set of nodes that {@code nodeId} replicates data to.
-     */
-    Set<Replica> getRemoteReplicas(String node);
-
-    /**
-     * @param nodeId
-     * @return true if {@code nodeId} has any remote primary replica or remote 
replica. Otherwise false.
-     */
-    default boolean isParticipant(String nodeId) {
-        return !getRemoteReplicas(nodeId).isEmpty() || 
!getRemotePrimaryReplicas(nodeId).isEmpty();
-    }
-
-    /**
-     * @param p
-     * @return A replication strategy based on the passed configurations.
-     */
-    IReplicationStrategy from(ReplicationProperties p, IConfigManager 
configManager) throws HyracksDataException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a5b641a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationThread.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationThread.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationThread.java
deleted file mode 100644
index 5b9d4fa..0000000
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationThread.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.asterix.common.replication;
-
-import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
-
-import org.apache.asterix.common.transactions.LogRecord;
-
-public interface IReplicationThread extends Runnable {
-
-    /**
-     * Sends a notification to this thread that logRecord has been flushed.
-     *
-     * @param logRecord The log that has been flushed.
-     */
-    void notifyLogReplicationRequester(LogRecord logRecord);
-
-    /**
-     * @return The replication socket channel.
-     */
-    SocketChannel getChannel();
-
-    /**
-     * Gets a reusable buffer that can be used to send data
-     *
-     * @return the reusable buffer
-     */
-    ByteBuffer getReusableBuffer();
-}

Reply via email to