Skip to content

Instantly share code, notes, and snippets.

public void testPartitionPlanWithBdbChanges() {
Cluster currentCluster = ServerTestUtils.getLocalCluster(2, new int[][] { { 1, 3, 5, 7 },
{ 0, 2, 4, 6 } });
Cluster targetCluster = ServerTestUtils.getLocalCluster(2, new int[][] { { 3, 5, 7 },
{ 1, 0, 2, 4, 6 } });
StoreDefinition def = ServerTestUtils.getStoreDef("test",
2,
@rsumbaly
rsumbaly / gist:955590
Created May 4, 2011 17:11
Optimization for BDB!
@Test
public void testRebalanceNodeRWStore() {
List<Integer> partitionsBeingMoved = Lists.newArrayList(0);
Cluster targetCluster = RebalanceUtils.createUpdatedCluster(cluster,
cluster.getNodeById(1),
cluster.getNodeById(0),
partitionsBeingMoved);
HashMap<ByteArray, byte[]> entrySet = ServerTestUtils.createRandomKeyValuePairs(10);
Current Cluster:
0 - [0, 4] - [3, 7] - [2, 6]
1 - [1, 5] - [0, 4] - [3, 7]
2 - [2, 6] - [1, 5] - [0, 4]
3 - [3, 7] - [2, 6] - [1, 5]
Target Cluster:
0 - [4] - [3] - [2]
1 - [0, 1, 5] - [4, 7] - [3, 6]
2 - [2, 6] - [0, 1, 5] - [4, 7]
a) Rollback-able - done
b) A version dedicated to rebalancing OR have a version for every primary partition movement ( 2nd one goes against (a) )
c) Check that all read-only stores have v2 - when checking for "normal state"
d) Move the retrieval of RO folders to the per stealer level?
e) Move only the correct set of data - add that to rebalance cluster plan [ Important for both RO and RW ]
f) Check for zone routing - copy from the same zone? - TODO
g) In the "createRebalancePartitionsInfo" function, need to actually return replica and replica_type. Then when finding places to get it from, put "zone_logic" in
h) Add a "--verify" function to rebalancing - After every primary partition migration, does a check!- TODO
i) Problem with RebalanceClusterPlan - TODO
j) Check if the RO store works correctly for different rep factors - TODO
package voldemort;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import voldemort.cluster.Cluster;
import voldemort.cluster.Node;
/*
* Copyright 2008-2009 LinkedIn, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
[2011-04-15 02:14:42,664 voldemort.server.niosocket.NioSelectorManager] ERROR
java.nio.channels.CancelledKeyException
at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55)
at sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:69)
at java.nio.channels.SelectionKey.isReadable(SelectionKey.java:271)
at voldemort.utils.SelectorManager.run(SelectorManager.java:191)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
ExecutorService service = Executors.newFixedThreadPool(1);
service.execute(new Runnable() {
public void run() {
try {
while(true) {
logger.info("=========PRINTING INFO=========");
logger.info("AvgTime\t" + storeStats.getAvgTimeInMs(Tracked.GET));
logger.info("MaxTime\t" + storeStats.getMaxLatencyInMs(Tracked.GET));
NEW FORMAT
Random Access Read Only store Results:
Null reads ratio:0.0
Total number of operations: 1000000
Total elapsed seconds: 3897.208826
Number of failures: 0
Number of threads: 10
Avg. operations/second: 256.5938969778983
Average time: 38.970634256 ms
@rsumbaly
rsumbaly / gist:909127
Created April 8, 2011 01:22
Trying out various reading patterns for FileChannel
package voldemort.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Arrays;
import java.util.Random;