-
Notifications
You must be signed in to change notification settings - Fork 141
[Issue #1252] optimize rocksdb index and mainindex #1256
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
59eb498
Fix concurreny issues
AntiO2 ba29302
optimize rocksdb index and mainindex
AntiO2 8926c2f
Fix Flush Process
AntiO2 2f4297e
Retina Flush Index
AntiO2 e1e913f
Merge remote-tracking branch 'pixels/master' into issue/1252
AntiO2 3ac1efb
log info
AntiO2 6117413
Merge remote-tracking branch 'pixels/master' into issue/1252
AntiO2 46f99dd
Fix IndexBuffer
AntiO2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...n-sqlite/src/test/java/io/pixelsdb/pixels/index/main/sqlite/TestSqliteMainIndexQuery.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| /* | ||
| * Copyright 2025 PixelsDB. | ||
| * | ||
| * This file is part of Pixels. | ||
| * | ||
| * Pixels is free software: you can redistribute it and/or modify | ||
| * it under the terms of the Affero GNU General Public License as | ||
| * published by the Free Software Foundation, either version 3 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * Pixels is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * Affero GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the Affero GNU General Public | ||
| * License along with Pixels. If not, see | ||
| * <https://www.gnu.org/licenses/>. | ||
| */ | ||
| package io.pixelsdb.pixels.index.main.sqlite; | ||
|
|
||
| import io.pixelsdb.pixels.common.exception.MainIndexException; | ||
| import io.pixelsdb.pixels.common.exception.RowIdException; | ||
| import io.pixelsdb.pixels.common.index.MainIndex; | ||
| import io.pixelsdb.pixels.common.index.MainIndexFactory; | ||
| import io.pixelsdb.pixels.common.index.RowIdRange; | ||
| import io.pixelsdb.pixels.common.utils.ConfigFactory; | ||
| import io.pixelsdb.pixels.index.IndexProto; | ||
| import org.apache.commons.io.FileUtils; | ||
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import java.io.File; | ||
| import java.io.IOException; | ||
| import java.sql.Connection; | ||
| import java.sql.DriverManager; | ||
| import java.sql.PreparedStatement; | ||
| import java.sql.ResultSet; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.concurrent.CountDownLatch; | ||
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.Executors; | ||
| import java.util.concurrent.Future; | ||
| public class TestSqliteMainIndexQuery | ||
| { | ||
| MainIndex mainIndex; | ||
| Long tableId =3035L; | ||
| Connection connection; | ||
| @BeforeEach | ||
| public void setUp() throws Exception | ||
| { | ||
| String sqlitePath = ConfigFactory.Instance().getProperty("index.sqlite.path"); | ||
| if (!sqlitePath.endsWith("/")) | ||
| { | ||
| sqlitePath += "/"; | ||
| } | ||
| mainIndex = MainIndexFactory.Instance().getMainIndex(tableId); | ||
| connection = DriverManager.getConnection("jdbc:sqlite:" + sqlitePath + tableId + ".main.index.db"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testQueryRowRanges() throws Exception | ||
| { | ||
| String query = "SELECT * FROM row_id_ranges order by row_id_start"; | ||
| long fileid = 0; | ||
| try (PreparedStatement pst = this.connection.prepareStatement(query)) | ||
| { | ||
| // pst.setLong(1, fileid); | ||
| try (ResultSet rs = pst.executeQuery()) | ||
| { | ||
| while (rs.next()) | ||
| { | ||
| long rowIdStart = rs.getLong("row_id_start"); | ||
| long rowIdEnd = rs.getLong("row_id_end"); | ||
| long fileId = rs.getLong("file_id"); | ||
| int rgId = rs.getInt("rg_id"); | ||
| int rgRowOffsetStart = rs.getInt("rg_row_offset_start"); | ||
| int rgRowOffsetEnd = rs.getInt("rg_row_offset_end"); | ||
| if (rowIdEnd - rowIdStart != rgRowOffsetEnd - rgRowOffsetStart) | ||
| { | ||
| throw new RowIdException("The width of row id range (" + rowIdStart + ", " + | ||
| rgRowOffsetEnd + ") does not match the width of row group row offset range (" + | ||
| rgRowOffsetStart + ", " + rgRowOffsetEnd + ")"); | ||
| } | ||
| System.out.println( | ||
| "rowIdStart=" + rowIdStart + | ||
| ", rowIdEnd=" + rowIdEnd + | ||
| ", fileId=" + fileId + | ||
| ", rgId=" + rgId + | ||
| ", rgRowOffsetStart=" + rgRowOffsetStart + | ||
| ", rgRowOffsetEnd=" + rgRowOffsetEnd | ||
| ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.