Skip to content
Snippets Groups Projects
Commit 45e8f737 authored by danielpoltx's avatar danielpoltx
Browse files

added additional zeropadding info, fixed formatting

parent d6f61f7d
No related branches found
No related tags found
No related merge requests found
/** /**
* Copyright (c) 2010 Yahoo! Inc. All rights reserved. * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you * Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You * may not use this file except in compliance with the License. You
* may obtain a copy of the License at * may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing * implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying * permissions and limitations under the License. See accompanying
* LICENSE file. * LICENSE file.
*/ */
package com.yahoo.ycsb; package com.yahoo.ycsb;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.Properties;
/** /**
* One experiment scenario. One object of this type will * One experiment scenario. One object of this type will
...@@ -34,8 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -34,8 +35,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* the "insertcount" property, which is interpreted by Client, can be used to tell each instance of the * the "insertcount" property, which is interpreted by Client, can be used to tell each instance of the
* client how many inserts to do. In the example above, both clients should have insertcount=500000. * client how many inserts to do. In the example above, both clients should have insertcount=500000.
*/ */
public abstract class Workload public abstract class Workload {
{
public static final String INSERT_START_PROPERTY = "insertstart"; public static final String INSERT_START_PROPERTY = "insertstart";
public static final String INSERT_COUNT_PROPERTY = "insertcount"; public static final String INSERT_COUNT_PROPERTY = "insertcount";
...@@ -43,71 +43,71 @@ public abstract class Workload ...@@ -43,71 +43,71 @@ public abstract class Workload
private volatile AtomicBoolean stopRequested = new AtomicBoolean(false); private volatile AtomicBoolean stopRequested = new AtomicBoolean(false);
/** /**
* Initialize the scenario. Create any generators and other shared objects here. * Initialize the scenario. Create any generators and other shared objects here.
* Called once, in the main client thread, before any operations are started. * Called once, in the main client thread, before any operations are started.
*/ */
public void init(Properties p) throws WorkloadException public void init(Properties p) throws WorkloadException {
{ }
}
/** /**
* Initialize any state for a particular client thread. Since the scenario object * Initialize any state for a particular client thread. Since the scenario object
* will be shared among all threads, this is the place to create any state that is specific * will be shared among all threads, this is the place to create any state that is specific
* to one thread. To be clear, this means the returned object should be created anew on each * to one thread. To be clear, this means the returned object should be created anew on each
* call to initThread(); do not return the same object multiple times. * call to initThread(); do not return the same object multiple times.
* The returned object will be passed to invocations of doInsert() and doTransaction() * The returned object will be passed to invocations of doInsert() and doTransaction()
* for this thread. There should be no side effects from this call; all state should be encapsulated * for this thread. There should be no side effects from this call; all state should be encapsulated
* in the returned object. If you have no state to retain for this thread, return null. (But if you have * in the returned object. If you have no state to retain for this thread, return null. (But if you have
* no state to retain for this thread, probably you don't need to override initThread().) * no state to retain for this thread, probably you don't need to override initThread().)
* *
* @return false if the workload knows it is done for this thread. Client will terminate the thread. Return true otherwise. Return true for workloads that rely on operationcount. For workloads that read traces from a file, return true when there are more to do, false when you are done. * @return false if the workload knows it is done for this thread. Client will terminate the thread.
*/ * Return true otherwise. Return true for workloads that rely on operationcount. For workloads that read
public Object initThread(Properties p, int mythreadid, int threadcount) throws WorkloadException * traces from a file, return true when there are more to do, false when you are done.
{ */
return null; public Object initThread(Properties p, int mythreadid, int threadcount) throws WorkloadException {
} return null;
}
/**
* Cleanup the scenario. Called once, in the main client thread, after all operations have completed.
*/
public void cleanup() throws WorkloadException
{
}
/**
* Do one insert operation. Because it will be called concurrently from multiple client threads, this
* function must be thread safe. However, avoid synchronized, or the threads will block waiting for each
* other, and it will be difficult to reach the target throughput. Ideally, this function would have no side
* effects other than DB operations and mutations on threadstate. Mutations to threadstate do not need to be
* synchronized, since each thread has its own threadstate instance.
*/
public abstract boolean doInsert(DB db, Object threadstate);
/** /**
* Do one transaction operation. Because it will be called concurrently from multiple client threads, this * Cleanup the scenario. Called once, in the main client thread, after all operations have completed.
* function must be thread safe. However, avoid synchronized, or the threads will block waiting for each */
* other, and it will be difficult to reach the target throughput. Ideally, this function would have no side public void cleanup() throws WorkloadException {
* effects other than DB operations and mutations on threadstate. Mutations to threadstate do not need to be }
* synchronized, since each thread has its own threadstate instance.
*
* @return false if the workload knows it is done for this thread. Client will terminate the thread. Return true otherwise. Return true for workloads that rely on operationcount. For workloads that read traces from a file, return true when there are more to do, false when you are done.
*/
public abstract boolean doTransaction(DB db, Object threadstate);
/** /**
* Allows scheduling a request to stop the workload. * Do one insert operation. Because it will be called concurrently from multiple client threads, this
*/ * function must be thread safe. However, avoid synchronized, or the threads will block waiting for each
public void requestStop() { * other, and it will be difficult to reach the target throughput. Ideally, this function would have no side
stopRequested.set(true); * effects other than DB operations and mutations on threadstate. Mutations to threadstate do not need to be
} * synchronized, since each thread has its own threadstate instance.
*/
public abstract boolean doInsert(DB db, Object threadstate);
/**
* Do one transaction operation. Because it will be called concurrently from multiple client threads, this
* function must be thread safe. However, avoid synchronized, or the threads will block waiting for each
* other, and it will be difficult to reach the target throughput. Ideally, this function would have no side
* effects other than DB operations and mutations on threadstate. Mutations to threadstate do not need to be
* synchronized, since each thread has its own threadstate instance.
*
* @return false if the workload knows it is done for this thread. Client will terminate the thread.
* Return true otherwise. Return true for workloads that rely on operationcount. For workloads that read
* traces from a file, return true when there are more to do, false when you are done.
*/
public abstract boolean doTransaction(DB db, Object threadstate);
/**
* Allows scheduling a request to stop the workload.
*/
public void requestStop() {
stopRequested.set(true);
}
/** /**
* Check the status of the stop request flag. * Check the status of the stop request flag.
* @return true if stop was requested, false otherwise. * @return true if stop was requested, false otherwise.
*/ */
public boolean isStopRequested() { public boolean isStopRequested() {
if (stopRequested.get() == true) return true; return stopRequested.get();
else return false; }
}
} }
/** /**
* Copyright (c) 2016 YCSB Contributors All rights reserved. * Copyright (c) 2016 YCSB Contributors All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you * Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You * may not use this file except in compliance with the License. You
* may obtain a copy of the License at * may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing * implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying * permissions and limitations under the License. See accompanying
* LICENSE file. * LICENSE file.
*/ */
package com.yahoo.ycsb.generator; package com.yahoo.ycsb.generator;
...@@ -24,10 +24,10 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -24,10 +24,10 @@ import java.util.concurrent.atomic.AtomicInteger;
*/ */
public class SequentialGenerator extends NumberGenerator { public class SequentialGenerator extends NumberGenerator {
final AtomicInteger counter; final AtomicInteger counter;
int _interval,_countstart; int _interval, _countstart;
/** /**
* Create a counter that starts at countstart * Create a counter that starts at countstart.
*/ */
public SequentialGenerator(int countstart, int countend) { public SequentialGenerator(int countstart, int countend) {
counter = new AtomicInteger(); counter = new AtomicInteger();
...@@ -37,23 +37,23 @@ public class SequentialGenerator extends NumberGenerator { ...@@ -37,23 +37,23 @@ public class SequentialGenerator extends NumberGenerator {
} }
/** /**
* If the generator returns numeric (integer) values, return the next value as an int. Default is to return -1, which * If the generator returns numeric (integer) values, return the next value as an int.
* is appropriate for generators that do not return numeric values. * Default is to return -1, which is appropriate for generators that do not return numeric values.
*/ */
public int nextInt() { public int nextInt() {
int ret = _countstart + counter.getAndIncrement()%_interval; int ret = _countstart + counter.getAndIncrement() % _interval;
setLastValue(ret); setLastValue(ret);
return ret; return ret;
} }
@Override @Override
public Number nextValue() { public Number nextValue() {
int ret = _countstart + counter.getAndIncrement()%_interval; int ret = _countstart + counter.getAndIncrement() % _interval;
setLastValue(ret); setLastValue(ret);
return ret; return ret;
} }
@Override @Override
public Number lastValue() { public Number lastValue() {
return counter.get() + 1; return counter.get() + 1;
} }
@Override @Override
public double mean() { public double mean() {
......
...@@ -74,7 +74,8 @@ import java.util.Vector; ...@@ -74,7 +74,8 @@ import java.util.Vector;
* <LI><b>zeropadding</b>: for generating a record sequence compatible with string sort order by * <LI><b>zeropadding</b>: for generating a record sequence compatible with string sort order by
* 0 padding the record number. Controls the number of 0s to use for padding. (default: 1) * 0 padding the record number. Controls the number of 0s to use for padding. (default: 1)
* For example for row 5, with zeropadding=1 you get 'user5' key and with zeropading=8 you get * For example for row 5, with zeropadding=1 you get 'user5' key and with zeropading=8 you get
* 'user00000005' key. * 'user00000005' key. In order to see its impact, zeropadding needs to be bigger than number of
* digits in the record number.
* <LI><b>insertorder</b>: should records be inserted in order by key ("ordered"), or in hashed * <LI><b>insertorder</b>: should records be inserted in order by key ("ordered"), or in hashed
* order ("hashed") (default: hashed) * order ("hashed") (default: hashed)
* </ul> * </ul>
...@@ -109,11 +110,11 @@ public class CoreWorkload extends Workload { ...@@ -109,11 +110,11 @@ public class CoreWorkload extends Workload {
/** /**
* The name of the property for the field length distribution. Options are "uniform", "zipfian" * The name of the property for the field length distribution. Options are "uniform", "zipfian"
* (favoring short records), "constant", and "histogram". * (favouring short records), "constant", and "histogram".
* *
* If "uniform", "zipfian" or "constant", the maximum field length will be that specified by the * If "uniform", "zipfian" or "constant", the maximum field length will be that specified by the
* fieldlength property. If "histogram", then the * fieldlength property. If "histogram", then the histogram will be read from the filename
* histogram will be read from the filename specified in the "fieldlengthhistogram" property. * specified in the "fieldlengthhistogram" property.
*/ */
public static final String FIELD_LENGTH_DISTRIBUTION_PROPERTY = "fieldlengthdistribution"; public static final String FIELD_LENGTH_DISTRIBUTION_PROPERTY = "fieldlengthdistribution";
...@@ -250,7 +251,7 @@ public class CoreWorkload extends Workload { ...@@ -250,7 +251,7 @@ public class CoreWorkload extends Workload {
public static final String REQUEST_DISTRIBUTION_PROPERTY = "requestdistribution"; public static final String REQUEST_DISTRIBUTION_PROPERTY = "requestdistribution";
/** /**
* The default distribution of requests across the keyspace * The default distribution of requests across the keyspace.
*/ */
public static final String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT = "uniform"; public static final String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT = "uniform";
...@@ -267,7 +268,7 @@ public class CoreWorkload extends Workload { ...@@ -267,7 +268,7 @@ public class CoreWorkload extends Workload {
/** /**
* The name of the property for the max scan length (number of records) * The name of the property for the max scan length (number of records).
*/ */
public static final String MAX_SCAN_LENGTH_PROPERTY = "maxscanlength"; public static final String MAX_SCAN_LENGTH_PROPERTY = "maxscanlength";
...@@ -407,8 +408,9 @@ public class CoreWorkload extends Workload { ...@@ -407,8 +408,9 @@ public class CoreWorkload extends Workload {
READMODIFYWRITE_PROPORTION_PROPERTY, READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT)); READMODIFYWRITE_PROPORTION_PROPERTY, READMODIFYWRITE_PROPORTION_PROPERTY_DEFAULT));
recordcount = recordcount =
Integer.parseInt(p.getProperty(Client.RECORD_COUNT_PROPERTY, Client.DEFAULT_RECORD_COUNT)); Integer.parseInt(p.getProperty(Client.RECORD_COUNT_PROPERTY, Client.DEFAULT_RECORD_COUNT));
if (recordcount == 0) if (recordcount == 0) {
recordcount = Integer.MAX_VALUE; recordcount = Integer.MAX_VALUE;
}
String requestdistrib = String requestdistrib =
p.getProperty(REQUEST_DISTRIBUTION_PROPERTY, REQUEST_DISTRIBUTION_PROPERTY_DEFAULT); p.getProperty(REQUEST_DISTRIBUTION_PROPERTY, REQUEST_DISTRIBUTION_PROPERTY_DEFAULT);
int maxscanlength = int maxscanlength =
...@@ -416,18 +418,18 @@ public class CoreWorkload extends Workload { ...@@ -416,18 +418,18 @@ public class CoreWorkload extends Workload {
String scanlengthdistrib = String scanlengthdistrib =
p.getProperty(SCAN_LENGTH_DISTRIBUTION_PROPERTY, SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT); p.getProperty(SCAN_LENGTH_DISTRIBUTION_PROPERTY, SCAN_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT);
int insertstart = int insertstart =
Integer.parseInt(p.getProperty(INSERT_START_PROPERTY,INSERT_START_PROPERTY_DEFAULT)); Integer.parseInt(p.getProperty(INSERT_START_PROPERTY, INSERT_START_PROPERTY_DEFAULT));
int insertcount = int insertcount =
Integer.parseInt(p.getProperty(INSERT_COUNT_PROPERTY,String.valueOf(recordcount-insertstart))); Integer.parseInt(p.getProperty(INSERT_COUNT_PROPERTY, String.valueOf(recordcount - insertstart)));
// Confirm valid values for insertstart and insertcount in relation to recordcount // Confirm valid values for insertstart and insertcount in relation to recordcount
if (recordcount < (insertstart + insertcount) ) { if (recordcount < (insertstart + insertcount)) {
System.err.println("Invalid combination of insertstart, insertcount and recordcount."); System.err.println("Invalid combination of insertstart, insertcount and recordcount.");
System.err.println("recordcount must be bigger than insertstart + insertcount."); System.err.println("recordcount must be bigger than insertstart + insertcount.");
System.exit(-1); System.exit(-1);
} }
zeropadding = zeropadding =
Integer.parseInt(p.getProperty(ZERO_PADDING_PROPERTY,ZERO_PADDING_PROPERTY_DEFAULT)); Integer.parseInt(p.getProperty(ZERO_PADDING_PROPERTY, ZERO_PADDING_PROPERTY_DEFAULT));
readallfields = Boolean.parseBoolean( readallfields = Boolean.parseBoolean(
p.getProperty(READ_ALL_FIELDS_PROPERTY, READ_ALL_FIELDS_PROPERTY_DEFAULT)); p.getProperty(READ_ALL_FIELDS_PROPERTY, READ_ALL_FIELDS_PROPERTY_DEFAULT));
...@@ -438,16 +440,14 @@ public class CoreWorkload extends Workload { ...@@ -438,16 +440,14 @@ public class CoreWorkload extends Workload {
p.getProperty(DATA_INTEGRITY_PROPERTY, DATA_INTEGRITY_PROPERTY_DEFAULT)); p.getProperty(DATA_INTEGRITY_PROPERTY, DATA_INTEGRITY_PROPERTY_DEFAULT));
// Confirm that fieldlengthgenerator returns a constant if data // Confirm that fieldlengthgenerator returns a constant if data
// integrity check requested. // integrity check requested.
if (dataintegrity if (dataintegrity && !(p.getProperty(
&& !(p.getProperty( FIELD_LENGTH_DISTRIBUTION_PROPERTY,
FIELD_LENGTH_DISTRIBUTION_PROPERTY, FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT)).equals("constant")) {
FIELD_LENGTH_DISTRIBUTION_PROPERTY_DEFAULT)).equals("constant")) {
System.err.println("Must have constant field size to check data integrity."); System.err.println("Must have constant field size to check data integrity.");
System.exit(-1); System.exit(-1);
} }
if (p.getProperty(INSERT_ORDER_PROPERTY, INSERT_ORDER_PROPERTY_DEFAULT).compareTo("hashed") if (p.getProperty(INSERT_ORDER_PROPERTY, INSERT_ORDER_PROPERTY_DEFAULT).compareTo("hashed") == 0) {
== 0) {
orderedinserts = false; orderedinserts = false;
} else if (requestdistrib.compareTo("exponential") == 0) { } else if (requestdistrib.compareTo("exponential") == 0) {
double percentile = Double.parseDouble(p.getProperty( double percentile = Double.parseDouble(p.getProperty(
...@@ -485,24 +485,25 @@ public class CoreWorkload extends Workload { ...@@ -485,24 +485,25 @@ public class CoreWorkload extends Workload {
transactioninsertkeysequence = new AcknowledgedCounterGenerator(recordcount); transactioninsertkeysequence = new AcknowledgedCounterGenerator(recordcount);
if (requestdistrib.compareTo("uniform") == 0) { if (requestdistrib.compareTo("uniform") == 0) {
keychooser=new UniformIntegerGenerator(insertstart,insertstart+insertcount-1); keychooser = new UniformIntegerGenerator(insertstart, insertstart + insertcount - 1);
} else if (requestdistrib.compareTo("sequential")==0) { } else if (requestdistrib.compareTo("sequential") == 0) {
keychooser=new SequentialGenerator(insertstart,insertstart+insertcount-1); keychooser = new SequentialGenerator(insertstart, insertstart + insertcount - 1);
}else if (requestdistrib.compareTo("zipfian") == 0) { }else if (requestdistrib.compareTo("zipfian") == 0) {
// it does this by generating a random "next key" in part by taking the modulus over the // it does this by generating a random "next key" in part by taking the modulus over the
// number of keys. // number of keys.
// If the number of keys changes, this would shift the modulus, and we don't want that to // If the number of keys changes, this would shift the modulus, and we don't want that to
// change which keys are popular so we'll actually construct the scrambled zipfian generator // change which keys are popular so we'll actually construct the scrambled zipfian generator
// with a keyspace that is larger than exists at the beginning of the test. that is, we'll predict // with a keyspace that is larger than exists at the beginning of the test. that is, we'll
// the number of inserts, and tell the scrambled zipfian generator the number of existing keys // predict the number of inserts, and tell the scrambled zipfian generator the number of
// plus the number of predicted keys as the total keyspace. then, if the generator picks a key // existing keys plus the number of predicted keys as the total keyspace. then, if the
// that hasn't been inserted yet, will just ignore it and pick another key. this way, the size of // generator picks a key that hasn't been inserted yet, will just ignore it and pick another
// the keyspace doesn't change from the perspective of the scrambled zipfian generator // key. this way, the size ofthe keyspace doesn't change from the perspective of the scrambled
// zipfian generator.
int opcount = Integer.parseInt(p.getProperty(Client.OPERATION_COUNT_PROPERTY)); int opcount = Integer.parseInt(p.getProperty(Client.OPERATION_COUNT_PROPERTY));
int expectednewkeys = (int) ((opcount) * insertproportion * 2.0); // 2 is fudge factor int expectednewkeys = (int) ((opcount) * insertproportion * 2.0); // 2 is fudge factor
keychooser=new ScrambledZipfianGenerator(insertstart,insertstart+insertcount+expectednewkeys); keychooser = new ScrambledZipfianGenerator(insertstart, insertstart + insertcount + expectednewkeys);
} else if (requestdistrib.compareTo("latest") == 0) { } else if (requestdistrib.compareTo("latest") == 0) {
keychooser = new SkewedLatestGenerator(transactioninsertkeysequence); keychooser = new SkewedLatestGenerator(transactioninsertkeysequence);
} else if (requestdistrib.equals("hotspot")) { } else if (requestdistrib.equals("hotspot")) {
...@@ -510,7 +511,8 @@ public class CoreWorkload extends Workload { ...@@ -510,7 +511,8 @@ public class CoreWorkload extends Workload {
Double.parseDouble(p.getProperty(HOTSPOT_DATA_FRACTION, HOTSPOT_DATA_FRACTION_DEFAULT)); Double.parseDouble(p.getProperty(HOTSPOT_DATA_FRACTION, HOTSPOT_DATA_FRACTION_DEFAULT));
double hotopnfraction = double hotopnfraction =
Double.parseDouble(p.getProperty(HOTSPOT_OPN_FRACTION, HOTSPOT_OPN_FRACTION_DEFAULT)); Double.parseDouble(p.getProperty(HOTSPOT_OPN_FRACTION, HOTSPOT_OPN_FRACTION_DEFAULT));
keychooser = new HotspotIntegerGenerator(insertstart, insertstart+insertcount-1, hotsetfraction, hotopnfraction); keychooser = new HotspotIntegerGenerator(insertstart, insertstart + insertcount - 1,
hotsetfraction, hotopnfraction);
} else { } else {
throw new WorkloadException("Unknown request distribution \"" + requestdistrib + "\""); throw new WorkloadException("Unknown request distribution \"" + requestdistrib + "\"");
} }
...@@ -528,7 +530,6 @@ public class CoreWorkload extends Workload { ...@@ -528,7 +530,6 @@ public class CoreWorkload extends Workload {
insertionRetryLimit = Integer.parseInt(p.getProperty( insertionRetryLimit = Integer.parseInt(p.getProperty(
INSERTION_RETRY_LIMIT, INSERTION_RETRY_LIMIT_DEFAULT)); INSERTION_RETRY_LIMIT, INSERTION_RETRY_LIMIT_DEFAULT));
insertionRetryInterval = Integer.parseInt(p.getProperty( insertionRetryInterval = Integer.parseInt(p.getProperty(
INSERTION_RETRY_INTERVAL, INSERTION_RETRY_INTERVAL_DEFAULT)); INSERTION_RETRY_INTERVAL, INSERTION_RETRY_INTERVAL_DEFAULT));
} }
...@@ -537,11 +538,13 @@ public class CoreWorkload extends Workload { ...@@ -537,11 +538,13 @@ public class CoreWorkload extends Workload {
if (!orderedinserts) { if (!orderedinserts) {
keynum = Utils.hash(keynum); keynum = Utils.hash(keynum);
} }
String value = Long.toString(keynum); String value = Long.toString(keynum);
int fill = zeropadding - value.length(); int fill = zeropadding - value.length();
String prekey = "user"; String prekey = "user";
for(int i=0; i<fill;i++) {prekey += '0';} for(int i=0; i<fill; i++) {
return prekey + value; prekey += '0';
}
return prekey + value;
} }
/** /**
...@@ -652,21 +655,20 @@ public class CoreWorkload extends Workload { ...@@ -652,21 +655,20 @@ public class CoreWorkload extends Workload {
@Override @Override
public boolean doTransaction(DB db, Object threadstate) { public boolean doTransaction(DB db, Object threadstate) {
switch (operationchooser.nextString()) { switch (operationchooser.nextString()) {
case "READ":
case "READ": doTransactionRead(db);
doTransactionRead(db); break;
break; case "UPDATE":
case "UPDATE": doTransactionUpdate(db);
doTransactionUpdate(db); break;
break; case "INSERT":
case "INSERT": doTransactionInsert(db);
doTransactionInsert(db); break;
break; case "SCAN":
case "SCAN": doTransactionScan(db);
doTransactionScan(db); break;
break; default:
default: doTransactionReadModifyWrite(db);
doTransactionReadModifyWrite(db);
} }
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment