Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datastore): can not load wal after restart #1223

Merged
merged 1 commit into from
Sep 16, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public int read() {
if (this.offset >= this.buffer.capacity()) {
return -1;
}
return this.buffer.getByte(this.offset++);
return (this.buffer.getByte(this.offset++) & 0xFF);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.hamcrest.Matchers.is;

import ai.starwhale.mlops.memory.impl.SwByteBufferManager;
import java.io.IOException;
import java.util.Arrays;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -55,4 +56,14 @@ public void testReadBytes() {
assertThat(this.inputStream.read(b, 0, 10), is(-1));
assertThat(this.inputStream.read(b, 0, 10), is(-1));
}

@Test
public void testReadff() throws IOException {
var buf = this.bufferManager.allocate(1);
buf.setByte(0, (byte) 0xFF);
try (var is = new SwBufferInputStream(buf)) {
var b = is.read();
assertThat(b, is(0xFF));
}
}
}