PlainTableFormat query does not have data
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
### TestCase
```
@Test
public void test3() throws IOException, RocksDBException {
File dbPath = new File("C:\\Users\\Administrator\\Desktop\\rockdb2");
if ((dbPath).exists()) {
FileUtils.deleteDirectory(dbPath);
}
if (!dbPath.mkdirs()) {
throw new IOException("Failed to mkdir on " + dbPath.getAbsolutePath());
}
Options options = new Options();
options.setCreateIfMissing(true);
options.setErrorIfExists(true);
options.useFixedLengthPrefixExtractor(10);
// options.useCappedPrefixExtractor(20);
options.setTableFormatConfig(new PlainTableConfig());
// options.setTableFormatConfig(new BlockBasedTableConfig());
RocksDB rocksDB = RocksDB.open(options, dbPath.getPath());
byte[] key1 = "232".getBytes(StandardCharsets.UTF_8);
byte[] key2 = "4443".getBytes(StandardCharsets.UTF_8);
rocksDB.put(key1, key1);
rocksDB.put(key2, key2);
rocksDB.flush(new FlushOptions());
RocksIterator iter = rocksDB.newIterator();
for (iter.seekToFirst(); iter.isValid(); iter.next()) {
Assert.assertNotNull(iter.key());
Assert.assertNotNull(iter.value());
}
// Not through
Assert.assertNotNull(rocksDB.get(key1));
Assert.assertNotNull(rocksDB.get(key2));
}
```
### Expected behavior
Assertion true:
```
Assert.assertNotNull(rocksDB.get(key1));
Assert.assertNotNull(rocksDB.get(key2));
```
### Actual behavior
Assertion false:
```
Assert.assertNotNull(rocksDB.get(key1));
Assert.assertNotNull(rocksDB.get(key2));
```
### Steps to reproduce the behavior
- windows10
- rocksdbjni version : 6.20.3
- useFixedLengthPrefixExtractor(final int n) , rocksDB.put(key1, key1), n greater than key.length
- options.setTableFormatConfig(new PlainTableConfig());
- rocksDB.flush(new FlushOptions());
### other
- Except for the parameters reproduced above, there are no problems with the other combinations of parameters
- PlainTableFormat: is there a special requirement for useFixedLengthPrefixExtractor?
Contributor guide
Assessment
This issue has not been assessed yet.