Skip to content

Commit

Permalink
feat: distinct filenames from different clients (#278)
Browse files Browse the repository at this point in the history
* feat: distinct filenames from different clients

* fix: variable declaration not allowed here

* fix: symbol:   variable jdx
  • Loading branch information
gangliao authored Jun 17, 2020
1 parent d7b1185 commit ed137d4
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.net.InetAddress;

import com.google.common.base.Preconditions;

Expand Down Expand Up @@ -604,14 +605,22 @@ void generateInputs(int[] opsPerThread) throws IOException {
clientProto.setSafeMode(HdfsConstants.SafeModeAction.SAFEMODE_LEAVE,
false);
// int generatedFileIdx = 0;
InetAddress inetAddress = InetAddress.getLocalHost();
int ipcode = inetAddress.getHostAddress().hashCode();
LOG.info("Current host address: " + inetAddress.getHostAddress() + ", HashCode: " + ipcode);
LOG.info("Generate " + numOpsRequired + " intputs for " + getOpName());
fileNames = new String[numThreads][];
String filename = null;
for(int idx=0; idx < numThreads; idx++) {
int threadOps = opsPerThread[idx];
fileNames[idx] = new String[threadOps];
for(int jdx=0; jdx < threadOps; jdx++)
fileNames[idx][jdx] = nameGenerator.
getNextFileName("ThroughputBench");
for(int jdx=0; jdx < threadOps; jdx++) {
filename = nameGenerator.getNextFileName("ThroughputBench");
if (!local) {
filename += String.valueOf(ipcode);
}
fileNames[idx][jdx] = filename;
}
}
}

Expand Down

0 comments on commit ed137d4

Please sign in to comment.