fix wrong name extraction
This commit is contained in:
parent
cb3366a559
commit
d674e155e1
|
@ -55,6 +55,13 @@ import com.minres.scviewer.database.tx.ITx;
|
||||||
*/
|
*/
|
||||||
public class TextDbLoader implements IWaveformDbLoader {
|
public class TextDbLoader implements IWaveformDbLoader {
|
||||||
|
|
||||||
|
/** the file size limit of a zipped txlog where the loader starts to use a file mapped database */
|
||||||
|
private static final long MEMMAP_LIMIT=256l*1024l*1024l;
|
||||||
|
|
||||||
|
private static final long MAPDB_INITIAL_ALLOC = 512l*1024l*1024l;
|
||||||
|
|
||||||
|
private static final long MAPDB_INCREMENTAL_ALLOC = 128l*1024l*1024l;
|
||||||
|
|
||||||
/** The max time. */
|
/** The max time. */
|
||||||
private Long maxTime = 0L;
|
private Long maxTime = 0L;
|
||||||
|
|
||||||
|
@ -162,10 +169,9 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
public void load(IWaveformDb db, File file) throws InputFormatException {
|
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||||
dispose();
|
dispose();
|
||||||
boolean gzipped = isGzipped(file);
|
boolean gzipped = isGzipped(file);
|
||||||
if (file.length() < 75000000 * (gzipped ? 1 : 10)
|
if (file.length() < MEMMAP_LIMIT * (gzipped ? 1 : 10)
|
||||||
|| "memory".equals(System.getProperty("ScvBackingDB", "file")))
|
|| "memory".equals(System.getProperty("ScvBackingDB", "file")))
|
||||||
mapDb = DBMaker.memoryDirectDB().allocateStartSize(512l * 1024l * 1024l)
|
mapDb = DBMaker.memoryDirectDB().make();
|
||||||
.allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
|
|
||||||
else {
|
else {
|
||||||
File mapDbFile;
|
File mapDbFile;
|
||||||
try {
|
try {
|
||||||
|
@ -175,8 +181,8 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
throw new InputFormatException(e.toString());
|
throw new InputFormatException(e.toString());
|
||||||
}
|
}
|
||||||
mapDb = DBMaker.fileDB(mapDbFile).fileMmapEnable() // Always enable mmap
|
mapDb = DBMaker.fileDB(mapDbFile).fileMmapEnable() // Always enable mmap
|
||||||
.fileMmapEnableIfSupported().fileMmapPreclearDisable().allocateStartSize(512l * 1024l * 1024l)
|
.fileMmapPreclearDisable().allocateStartSize(MAPDB_INITIAL_ALLOC)
|
||||||
.allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
|
.allocateIncrement(MAPDB_INCREMENTAL_ALLOC).cleanerHackEnable().make();
|
||||||
mapDbFile.deleteOnExit();
|
mapDbFile.deleteOnExit();
|
||||||
}
|
}
|
||||||
TextDbParser parser = new TextDbParser(this);
|
TextDbParser parser = new TextDbParser(this);
|
||||||
|
@ -348,10 +354,9 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
String[] tokens = curLine.split("\\s+");
|
String[] tokens = curLine.split("\\s+");
|
||||||
if ("tx_record_attribute".equals(tokens[0])) {
|
if ("tx_record_attribute".equals(tokens[0])) {
|
||||||
Long id = Long.parseLong(tokens[1]);
|
Long id = Long.parseLong(tokens[1]);
|
||||||
String name = tokens[2].substring(1, tokens[2].length());
|
String name = tokens[2].substring(1, tokens[2].length()-1);
|
||||||
DataType type = DataType.valueOf(tokens[3]);
|
DataType type = DataType.valueOf(tokens[3]);
|
||||||
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length))
|
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)) : "";
|
||||||
: "";
|
|
||||||
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
|
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
|
||||||
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
|
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
|
||||||
} else if ("tx_begin".equals(tokens[0])) {
|
} else if ("tx_begin".equals(tokens[0])) {
|
||||||
|
|
Loading…
Reference in New Issue