From fb78ea10758fc6b3d8371c5498b25f9a8dadef9c Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Wed, 7 Sep 2016 00:54:29 +0000 Subject: [PATCH] remove debug output git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/mutateops@1028 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/impl/ByteUtil.java | 1 - .../jackcess/impl/LongValueColumnImpl.java | 1 - .../jackcess/impl/RelationshipCreator.java | 1 + .../jackcess/impl/TableCreator.java | 2 +- .../jackcess/impl/TableImpl.java | 23 ------------------- .../jackcess/impl/TableUpdater.java | 2 ++ 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java index 96285e8..efb5587 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java @@ -408,7 +408,6 @@ public final class ByteUtil { byte[] buf = buffer.array(); int pos = buffer.position(); int limit = buffer.limit(); - System.out.println("FOO insert " + pos + " " + len + " " + limit + " " + buffer.capacity()); System.arraycopy(buf, pos, buf, pos + len, limit - pos); Arrays.fill(buf, pos, pos + len, (byte)0); buffer.limit(limit + len); diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/LongValueColumnImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/LongValueColumnImpl.java index 6caf27c..8a137ea 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/LongValueColumnImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/LongValueColumnImpl.java @@ -68,7 +68,6 @@ class LongValueColumnImpl extends ColumnImpl @Override void setUsageMaps(UsageMap ownedPages, UsageMap freeSpacePages) { - System.out.println("FOO setting col umaps " + ownedPages); _lvalBufferH = new UmapLongValueBufferHolder(ownedPages, freeSpacePages); } diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java b/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java index dcfdf3d..aee71ae 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java @@ -30,6 +30,7 @@ import com.healthmarketscience.jackcess.RelationshipBuilder; import com.healthmarketscience.jackcess.Row; /** + * Helper class used to maintain state during relationship creation. * * @author James Ahlborn */ diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableCreator.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableCreator.java index df6076a..cb7d129 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/TableCreator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableCreator.java @@ -181,7 +181,7 @@ public class TableCreator extends TableMutator } } - getPageChannel().startWrite(); + getPageChannel().startExclusiveWrite(); try { // reserve some pages diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java index 83f96f6..e1b0d1e 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java @@ -227,10 +227,6 @@ public class TableImpl implements Table _name = name; _flags = flags; - System.out.println("FOO " + _name + " tdefLen " + tableBuffer.getInt(8) + - " free " + - tableBuffer.getShort(database.getFormat().OFFSET_FREE_SPACE)); - // read table definition tableBuffer = loadCompleteTableDefinitionBuffer(tableBuffer, null); @@ -266,8 +262,6 @@ public class TableImpl implements Table // keep reading ... } - System.out.println("FOO done " + tableBuffer.position()); - // re-sort columns if necessary if(getDatabase().getColumnOrder() != ColumnOrder.DATA) { Collections.sort(_columns, DISPLAY_ORDER_COMPARATOR); @@ -1052,10 +1046,6 @@ public class TableImpl implements Table { buffer.rewind(); int totalTableDefSize = buffer.remaining(); - System.out.println("FOO writing tdef to " + tdefPageNumber + " and " + - reservedPages + " tot size " + totalTableDefSize + " " + - buffer.remaining()); - JetFormat format = mutator.getFormat(); PageChannel pageChannel = mutator.getPageChannel(); @@ -1074,8 +1064,6 @@ public class TableImpl implements Table } else { - System.out.println("FOO splitting tdef"); - // need to split across multiple pages ByteBuffer partialTdef = pageChannel.createPageBuffer(); @@ -1204,15 +1192,12 @@ public class TableImpl implements Table // skip existing column names and write new name skipNames(tableBuffer, _columns.size()); ByteUtil.insertEmptyData(tableBuffer, nameByteLen); - System.out.println("FOO pre name " + tableBuffer.position()); writeName(tableBuffer, column.getName(), mutator.getCharset()); - System.out.println("FOO post name " + tableBuffer.position()); if(isLongVal) { // allocate usage maps for the long value col Map.Entry umapInfo = addUsageMaps(2, null); - System.out.println("FOO created umap " + umapInfo); TableMutator.ColumnState colState = mutator.getColumnState(column); colState.setUmapPageNumber(umapInfo.getKey()); byte rowNum = umapInfo.getValue().byteValue(); @@ -1220,13 +1205,10 @@ public class TableImpl implements Table colState.setUmapFreeRowNumber((byte)(rowNum + 1)); // skip past index defs - System.out.println("FOO pre move " + tableBuffer.position()); ByteUtil.forward(tableBuffer, (_indexCount * format.SIZE_INDEX_COLUMN_BLOCK)); - System.out.println("FOO moved to " + tableBuffer.position()); ByteUtil.forward(tableBuffer, (_logicalIndexCount * format.SIZE_INDEX_INFO_BLOCK)); - System.out.println("FOO moved to " + tableBuffer.position()); skipNames(tableBuffer, _logicalIndexCount); // skip existing usage maps @@ -1243,7 +1225,6 @@ public class TableImpl implements Table } // write new column usage map info - System.out.println("FOO about to write " + tableBuffer.position()); umapPos = tableBuffer.position(); ByteUtil.insertEmptyData(tableBuffer, 10); ColumnImpl.writeColUsageMapDefinition( @@ -1359,7 +1340,6 @@ public class TableImpl implements Table TableMutator.IndexDataState idxDataState = mutator.getIndexDataState(index); int rootPageNumber = getPageChannel().allocateNewPage(); Map.Entry umapInfo = addUsageMaps(1, rootPageNumber); - System.out.println("FOO created umap " + umapInfo); idxDataState.setRootPageNumber(rootPageNumber); idxDataState.setUmapPageNumber(umapInfo.getKey()); idxDataState.setUmapRowNumber(umapInfo.getValue().byteValue()); @@ -1566,7 +1546,6 @@ public class TableImpl implements Table int origTdefLen = tableBuffer.getInt(8); mutator.setOrigTdefLen(origTdefLen); int newTdefLen = origTdefLen + addedLen; - System.out.println("FOO new " + newTdefLen + " add " + addedLen); while(newTdefLen > tableBuffer.capacity()) { tableBuffer = expandTableBuffer(tableBuffer); tableBuffer.flip(); @@ -1600,7 +1579,6 @@ public class TableImpl implements Table // numbers), so we sort in reverse order. Set knownPages = new TreeSet(Collections.reverseOrder()); collectUsageMapPages(knownPages); - System.out.println("FOO found umap pages " + knownPages); ByteBuffer umapBuf = pageChannel.createPageBuffer(); for(Integer pageNum : knownPages) { @@ -1874,7 +1852,6 @@ public class TableImpl implements Table } getPageChannel().readPage(nextPageBuffer, nextPage); nextPage = nextPageBuffer.getInt(getFormat().OFFSET_NEXT_TABLE_DEF_PAGE); - System.out.println("FOO next page free " + nextPageBuffer.getShort(getFormat().OFFSET_FREE_SPACE)); tableBuffer = expandTableBuffer(tableBuffer); tableBuffer.put(nextPageBuffer.array(), 8, getFormat().PAGE_SIZE - 8); tableBuffer.flip(); diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableUpdater.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableUpdater.java index 724a1fa..8d8f348 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/TableUpdater.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableUpdater.java @@ -168,6 +168,8 @@ public class TableUpdater extends TableMutator if(!isInternal) { getPageChannel().startExclusiveWrite(); } else { + // if "internal" update, this is part of a larger operation which + // already holds an exclusive write lock getPageChannel().startWrite(); } try { -- 2.39.5