Unverified 提交 04b85386 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1386 from katzyn/misc

DISK_SPACE_USED() for MVStore and other minor changes
...@@ -21,6 +21,44 @@ Change Log ...@@ -21,6 +21,44 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>PR #1386: DISK_SPACE_USED() for MVStore and other minor changes
</li>
<li>PR #1385: split up the rather large convertTo method
</li>
<li>PR #1384: Throw exception if unknown mode is specified in database URL
</li>
<li>Issue #1365, PR #1382: Parse more date-time literals for compatibility with other databases
</li>
<li>PR #1381: Minor fixes for INTERVAL data type
</li>
<li>PR #1380: Improve documentation of intervals
</li>
<li>Issue #1189: "Merge into using" parameters aren't found
</li>
<li>Issue #1377: org.h2.api.Interval and TIME leftovers
</li>
<li>PR #1376: TestMultiThreadedKernel is back
</li>
<li>PR #1373: INTERVAL data type
</li>
<li>Issue #1369: In MSSQL Server Mode generated UUID fields need NEWID() function
</li>
<li>Issue #756: FunctionsMySql is not in the main jar
</li>
<li>PR #1368: Parse BINARY VARYING, BINARY LARGE OBJECT, and CHARACTER LARGE OBJECT
</li>
<li>PR #1367: Assorted changes with SELECT output limitation clauses
</li>
<li>Issue #1363: Why H2 requires random own packages in OSGi bundle description?
</li>
<li>Issue #1192: Add an Automatic-Module-Name
</li>
<li>Issue #1361, PR #1362: Add limited support for MONEY and SMALLMONEY in compatibility modes
</li>
<li>Issue #1327: mvn build misses some resources
</li>
<li>PR #1359: Add system property to return OffsetDateTime from ResultSet.getObject()
</li>
<li>PR #1357: Simplify execution flow in some places <li>PR #1357: Simplify execution flow in some places
</li> </li>
<li>PR #1356: Fix NPE in Query.initExpression() <li>PR #1356: Fix NPE in Query.initExpression()
......
...@@ -115,7 +115,7 @@ public class Analyze extends DefineCommand { ...@@ -115,7 +115,7 @@ public class Analyze extends DefineCommand {
} }
buff.append(" FROM ").append(table.getSQL()); buff.append(" FROM ").append(table.getSQL());
if (sample > 0) { if (sample > 0) {
buff.append(" FETCH NEXT ROW ONLY SAMPLE_SIZE ? "); buff.append(" FETCH FIRST ROW ONLY SAMPLE_SIZE ? ");
} }
String sql = buff.toString(); String sql = buff.toString();
Prepared command = session.prepare(sql); Prepared command = session.prepare(sql);
......
...@@ -877,7 +877,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba ...@@ -877,7 +877,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
removeTemporaryLobs(false); removeTemporaryLobs(false);
cleanTempTables(true); cleanTempTables(true);
commit(true); // temp table rempval may have opened new transaction commit(true); // temp table removal may have opened new transaction
if (undoLog != null) { if (undoLog != null) {
undoLog.clear(); undoLog.clear();
} }
......
...@@ -54,6 +54,11 @@ public abstract class Page implements Cloneable ...@@ -54,6 +54,11 @@ public abstract class Page implements Cloneable
*/ */
private int memory; private int memory;
/**
* Amount of used disk space by this page only in persistent case.
*/
private int diskSpaceUsed;
/** /**
* The keys. * The keys.
*/ */
...@@ -672,6 +677,7 @@ public abstract class Page implements Cloneable ...@@ -672,6 +677,7 @@ public abstract class Page implements Cloneable
if (isLeaf()) { if (isLeaf()) {
readPayLoad(buff); readPayLoad(buff);
} }
diskSpaceUsed = maxLength;
recalculateMemory(); recalculateMemory();
} }
...@@ -748,7 +754,7 @@ public abstract class Page implements Cloneable ...@@ -748,7 +754,7 @@ public abstract class Page implements Cloneable
// for a longer time // for a longer time
store.cachePage(this); store.cachePage(this);
} }
long max = DataUtils.getPageMaxLength(pos); int max = DataUtils.getPageMaxLength(pos);
chunk.maxLen += max; chunk.maxLen += max;
chunk.maxLenLive += max; chunk.maxLenLive += max;
chunk.pageCount++; chunk.pageCount++;
...@@ -759,6 +765,7 @@ public abstract class Page implements Cloneable ...@@ -759,6 +765,7 @@ public abstract class Page implements Cloneable
// when the next chunk is stored // when the next chunk is stored
map.removePage(pos, memory); map.removePage(pos, memory);
} }
diskSpaceUsed = max != DataUtils.PAGE_LARGE ? max : pageLength;
return typePos + 1; return typePos + 1;
} }
...@@ -805,6 +812,27 @@ public abstract class Page implements Cloneable ...@@ -805,6 +812,27 @@ public abstract class Page implements Cloneable
return 0; return 0;
} }
/**
* Amount of used disk space in persistent case including child pages.
*
* @return amount of used disk space in persistent case
*/
public long getDiskSpaceUsed() {
long r = 0;
if (isPersistent()) {
r += diskSpaceUsed;
}
if (!isLeaf()) {
for (int i = 0; i < getRawChildPageCount(); i++) {
long pos = getChildPagePos(i);
if (pos != 0) {
r += getChildPage(i).getDiskSpaceUsed();
}
}
}
return r;
}
final void addMemory(int mem) { final void addMemory(int mem) {
memory += mem; memory += mem;
} }
......
...@@ -358,8 +358,7 @@ public class MVPrimaryIndex extends BaseIndex { ...@@ -358,8 +358,7 @@ public class MVPrimaryIndex extends BaseIndex {
@Override @Override
public long getDiskSpaceUsed() { public long getDiskSpaceUsed() {
// TODO estimate disk space usage return dataMap.map.getRootPage().getDiskSpaceUsed();
return 0;
} }
public String getMapName() { public String getMapName() {
......
...@@ -195,7 +195,7 @@ public class ColumnNamerConfiguration { ...@@ -195,7 +195,7 @@ public class ColumnNamerConfiguration {
break; break;
case PostgreSQL: case PostgreSQL:
// this default can be changed to 128 by postgres config // https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html
setMaxIdentiferLength(63); setMaxIdentiferLength(63);
setRegularExpressionMatchAllowed("(?m)(?s)[A-Za-z0-9_\\$]+"); setRegularExpressionMatchAllowed("(?m)(?s)[A-Za-z0-9_\\$]+");
setRegularExpressionMatchDisallowed("(?m)(?s)[^A-Za-z0-9_\\$]"); setRegularExpressionMatchDisallowed("(?m)(?s)[^A-Za-z0-9_\\$]");
...@@ -204,7 +204,8 @@ public class ColumnNamerConfiguration { ...@@ -204,7 +204,8 @@ public class ColumnNamerConfiguration {
break; break;
case MySQL: case MySQL:
// https://dev.mysql.com/doc/refman/5.7/en/identifiers.html // https://dev.mysql.com/doc/refman/8.0/en/identifiers.html
// https://mariadb.com/kb/en/library/identifier-names/
setMaxIdentiferLength(64); setMaxIdentiferLength(64);
setRegularExpressionMatchAllowed("(?m)(?s)`?[A-Za-z0-9_`\\$]+`?"); setRegularExpressionMatchAllowed("(?m)(?s)`?[A-Za-z0-9_`\\$]+`?");
setRegularExpressionMatchDisallowed("(?m)(?s)[^A-Za-z0-9_`\\$]"); setRegularExpressionMatchDisallowed("(?m)(?s)[^A-Za-z0-9_`\\$]");
......
...@@ -789,3 +789,4 @@ inconsistencies discover eliminated violates tweaks postpone leftovers ...@@ -789,3 +789,4 @@ inconsistencies discover eliminated violates tweaks postpone leftovers
tied ties tied ties
launched unavailable smallmoney erroneously multiplier newid pan streamline unmap preview unexpectedly presumably launched unavailable smallmoney erroneously multiplier newid pan streamline unmap preview unexpectedly presumably
converging smth rng curs casts unmapping unmapper converging smth rng curs casts unmapping unmapper
immediate hhmmss scheduled hhmm prematurely postponed arranges
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论