Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/test/java/org/lmdbjava/CursorIterableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void atMostTest() {
public void before() throws IOException {
final File path = tmp.newFile();
env = create()
.setMapSize(KIBIBYTES.toBytes(100))
.setMapSize(KIBIBYTES.toBytes(256))
.setMaxReaders(1)
.setMaxDbs(1)
.open(path, POSIX_MODE, MDB_NOSUBDIR);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/lmdbjava/DbiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public void stats() {
assertThat(stat.entries, is(3L));
assertThat(stat.leafPages, is(1L));
assertThat(stat.overflowPages, is(0L));
assertThat(stat.pageSize, is(4_096));
assertThat(stat.pageSize % 4_096, is(0));
}

@Test(expected = MapFullException.class)
Expand Down
11 changes: 6 additions & 5 deletions src/test/java/org/lmdbjava/EnvTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package org.lmdbjava;

import static com.jakewharton.byteunits.BinaryByteUnit.KIBIBYTES;
import static com.jakewharton.byteunits.BinaryByteUnit.MEBIBYTES;
import static java.nio.ByteBuffer.allocateDirect;
import static org.hamcrest.CoreMatchers.containsString;
Expand Down Expand Up @@ -338,15 +339,15 @@ public void setMapSize() throws IOException {
final Random rnd = new Random();
try (Env<ByteBuffer> env = create()
.setMaxReaders(1)
.setMapSize(50_000)
.setMapSize(KIBIBYTES.toBytes(256))
Comment thread
bp-alex marked this conversation as resolved.
.setMaxDbs(1)
.open(path)) {
final Dbi<ByteBuffer> db = env.openDbi(DB_1, MDB_CREATE);

db.put(bb(1), bb(42));
boolean mapFullExThrown = false;
try {
for (int i = 0; i < 30; i++) {
for (int i = 0; i < 70; i++) {
rnd.nextBytes(k);
key.clear();
key.put(k).flip();
Expand All @@ -358,15 +359,15 @@ public void setMapSize() throws IOException {
}
assertThat(mapFullExThrown, is(true));

env.setMapSize(500_000);
env.setMapSize(KIBIBYTES.toBytes(512));

try (Txn<ByteBuffer> roTxn = env.txnRead()) {
assertThat(db.get(roTxn, bb(1)).getInt(), is(42));
}

mapFullExThrown = false;
try {
for (int i = 0; i < 30; i++) {
for (int i = 0; i < 70; i++) {
rnd.nextBytes(k);
key.clear();
key.put(k).flip();
Expand All @@ -393,7 +394,7 @@ public void stats() throws IOException {
assertThat(stat.entries, is(0L));
assertThat(stat.leafPages, is(0L));
assertThat(stat.overflowPages, is(0L));
assertThat(stat.pageSize, is(4_096));
assertThat(stat.pageSize % 4_096, is(0));
assertThat(stat.toString(), containsString("pageSize="));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/lmdbjava/TxnTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void after() {
public void before() throws IOException {
path = tmp.newFile();
env = create()
.setMapSize(KIBIBYTES.toBytes(100))
.setMapSize(KIBIBYTES.toBytes(256))
.setMaxReaders(1)
.setMaxDbs(2)
.open(path, POSIX_MODE, MDB_NOSUBDIR);
Expand Down