Skip to content

Commit 4ac5343

Browse files
authored
Merge pull request #3834 from katzyn/version
Increase database format version
2 parents 581ed18 + 72f6e98 commit 4ac5343

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

h2/src/docsrc/html/changelog.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ <h1>Change Log</h1>
2121

2222
<h2>Next Version (unreleased)</h2>
2323
<ul>
24+
<li>PR #3834: Increase database format version
25+
</li>
26+
<li>PR #3833: Disallow plain webAdminPassword values to force usage of hashes
27+
</li>
2428
<li>PR #3831: Add Oracle-style NOWAIT, WAIT n, and SKIP LOCKED to FOR UPDATE clause
2529
</li>
2630
<li>RP #3830: Fix time zone of time/timestamp with time zone AT LOCAL

h2/src/main/org/h2/mvstore/FileStore.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public abstract class FileStore<C extends Chunk<C>>
8080
*/
8181
static final int BLOCK_SIZE = 4 * 1024;
8282

83-
private static final int FORMAT_WRITE_MIN = 2;
84-
private static final int FORMAT_WRITE_MAX = 2;
85-
private static final int FORMAT_READ_MIN = 2;
86-
private static final int FORMAT_READ_MAX = 2;
83+
private static final int FORMAT_WRITE_MIN = 3;
84+
private static final int FORMAT_WRITE_MAX = 3;
85+
private static final int FORMAT_READ_MIN = 3;
86+
private static final int FORMAT_READ_MAX = 3;
8787

8888
MVStore mvStore;
8989
private boolean closed;

h2/src/main/org/h2/tools/Upgrade.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ public final class Upgrade {
118118
/* 1.4.198 */ "32dd6b149cb722aa4c2dd4d40a74a9cd41e32ac59a4e755a66e5753660d61d46",
119119
/* 1.4.199 */ "3125a16743bc6b4cfbb61abba783203f1fb68230aa0fdc97898f796f99a5d42e",
120120
/* 1.4.200 */ "3ad9ac4b6aae9cd9d3ac1c447465e1ed06019b851b893dd6a8d76ddb6d85bca6",
121+
/* 2.0.202 */ "95090f0609aacb0ee339128ef04077145ef28320ee874ea2e33a692938da5b97",
122+
/* 2.0.204 */ "712a616409580bd4ac7c10e48f2599cc32ba3a433a1804da619c3f0a5ef66a04",
123+
/* 2.0.206 */ "3b9607c5673fd8b87e49e3ac46bd88fd3561e863dce673a35234e8b5708f3deb",
124+
/* 2.0.208 */ null,
125+
/* 2.1.210 */ "edc57299926297fd9315e04de75f8538c4cb5fe97fd3da2a1e5cee6a4c98b5cd",
126+
/* 2.1.212 */ "db9284c6ff9bf3bc0087851edbd34563f1180df3ae87c67c5fe2203c0e67a536",
127+
/* 2.1.214 */ "d623cdc0f61d218cf549a8d09f1c391ff91096116b22e2475475fce4fbe72bd0",
128+
/* 2.1.216 */ null,
129+
/* 2.1.218 */ null,
121130
//
122131
};
123132

@@ -227,7 +236,9 @@ public static java.sql.Driver loadH2(int version) throws IOException, Reflective
227236
if ((version & 1) != 0 || version > Constants.BUILD_ID) {
228237
throw new IllegalArgumentException("version=" + version);
229238
}
230-
prefix = "2.0.";
239+
int major = version / 100;
240+
int minor = version / 10 % 10;
241+
prefix = new StringBuilder().append(major).append('.').append(minor).append('.').toString();
231242
} else if (version >= 177) {
232243
prefix = "1.4.";
233244
} else if (version >= 146 && version != 147) {
@@ -238,7 +249,8 @@ public static java.sql.Driver loadH2(int version) throws IOException, Reflective
238249
throw new IllegalArgumentException("version=" + version);
239250
}
240251
String fullVersion = prefix + version;
241-
byte[] data = downloadUsingMaven("com.h2database", "h2", fullVersion, CHECKSUMS[version - 120]);
252+
byte[] data = downloadUsingMaven("com.h2database", "h2", fullVersion,
253+
CHECKSUMS[version >= 202 ? (version >>> 1) - 20 : version - 120]);
242254
ZipInputStream is = new ZipInputStream(new ByteArrayInputStream(data));
243255
HashMap<String, byte[]> map = new HashMap<>(version >= 198 ? 2048 : 1024);
244256
ByteArrayOutputStream baos = new ByteArrayOutputStream();

h2/src/test/org/h2/test/store/TestMVStore.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
*/
4040
public class TestMVStore extends TestBase {
4141

42+
private static final int CURRENT_FORMAT = 3;
43+
4244
/**
4345
* Run just this test.
4446
*
@@ -426,9 +428,9 @@ private void testNewerWriteVersion() {
426428
open();
427429
s.setRetentionTime(Integer.MAX_VALUE);
428430
Map<String, Object> header = s.getStoreHeader();
429-
assertEquals("2", header.get("format").toString());
430-
header.put("formatRead", "2");
431-
header.put("format", "3");
431+
assertEquals(Integer.toString(CURRENT_FORMAT), header.get("format").toString());
432+
header.put("formatRead", Integer.toString(CURRENT_FORMAT));
433+
header.put("format", Integer.toString(CURRENT_FORMAT + 1));
432434
forceWriteStoreHeader(s);
433435
MVMap<Integer, String> m = s.openMap("data");
434436
forceWriteStoreHeader(s);
@@ -727,7 +729,7 @@ private void testFileFormatChange() {
727729
m.put(1, 1);
728730
Map<String, Object> header = s.getStoreHeader();
729731
int format = Integer.parseInt(header.get("format").toString());
730-
assertEquals(2, format);
732+
assertEquals(CURRENT_FORMAT, format);
731733
header.put("format", Integer.toString(format + 1));
732734
forceWriteStoreHeader(s);
733735
}
@@ -849,7 +851,7 @@ private void testFileHeader() {
849851
s.setRetentionTime(Integer.MAX_VALUE);
850852
long time = System.currentTimeMillis();
851853
Map<String, Object> m = s.getStoreHeader();
852-
assertEquals("2", m.get("format").toString());
854+
assertEquals(Integer.toString(CURRENT_FORMAT), m.get("format").toString());
853855
long creationTime = (Long) m.get("created");
854856
assertTrue(Math.abs(time - creationTime) < 100);
855857
m.put("test", "123");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy