-
Notifications
You must be signed in to change notification settings - Fork 40
Support transaction metadata decoupling in Consensus Commit #3207
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
brfrn169
merged 8 commits into
master
from
support-transaction-metadata-decoupling-in-consensus-commit
Nov 25, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
629633b
Support transaction metadata decoupling in Consensus Commit
brfrn169 c33661f
Fix
brfrn169 a7f4cd8
[skip ci] fix
brfrn169 f812da1
[skip ci] fix
brfrn169 799c3fb
Merge branch 'master' into support-transaction-metadata-decoupling-in…
brfrn169 9447ae7
Fix based on feedback
brfrn169 f585e04
Merge branch 'master' into support-transaction-metadata-decoupling-in…
feeblefakie f5adb27
Merge branch 'master' into support-transaction-metadata-decoupling-in…
brfrn169 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
89 changes: 89 additions & 0 deletions
89
...ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase.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,89 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import com.scalar.db.api.DistributedStorageAdminImportTableIntegrationTestBase.TestData; | ||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.exception.storage.ExecutionException; | ||
| import com.scalar.db.transaction.consensuscommit.ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestBase; | ||
| import java.sql.SQLException; | ||
| import java.util.List; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.condition.DisabledIf; | ||
| import org.junit.jupiter.api.condition.EnabledIf; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| @DisabledIf("com.scalar.db.storage.jdbc.JdbcEnv#isOracle") | ||
| public class ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase | ||
| extends ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestBase { | ||
| private static final Logger logger = | ||
| LoggerFactory.getLogger( | ||
| ConsensusCommitAdminImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase | ||
| .class); | ||
|
|
||
| private JdbcAdminImportTestUtils testUtils; | ||
|
|
||
| @Override | ||
| protected Properties getProps(String testName) { | ||
| Properties properties = JdbcEnv.getProperties(testName); | ||
|
|
||
| // Set the isolation level for consistency reads for virtual tables | ||
| RdbEngineStrategy rdbEngine = | ||
| RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| properties.setProperty( | ||
| JdbcConfig.ISOLATION_LEVEL, | ||
| JdbcTestUtils.getIsolationLevel( | ||
| rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead()) | ||
| .name()); | ||
|
|
||
| testUtils = new JdbcAdminImportTestUtils(properties); | ||
| return properties; | ||
| } | ||
|
|
||
| @Override | ||
| public void afterAll() { | ||
| try { | ||
| super.afterAll(); | ||
| } catch (Exception e) { | ||
| logger.warn("Failed to call super.afterAll", e); | ||
| } | ||
|
|
||
| try { | ||
| if (testUtils != null) { | ||
| testUtils.close(); | ||
| } | ||
| } catch (Exception e) { | ||
| logger.warn("Failed to close test utils", e); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| protected List<TestData> createExistingDatabaseWithAllDataTypes() throws SQLException { | ||
| return testUtils.createExistingDatabaseWithAllDataTypes(namespace); | ||
| } | ||
|
|
||
| @Override | ||
| protected void dropNonImportableTable(String table) throws SQLException { | ||
| testUtils.dropTable(namespace, table); | ||
| } | ||
|
|
||
| @SuppressWarnings("unused") | ||
| private boolean isSqlite() { | ||
| return JdbcEnv.isSqlite(); | ||
| } | ||
|
|
||
| @Test | ||
| @Override | ||
| @DisabledIf("isSqlite") | ||
| public void importTable_ShouldWorkProperly() throws Exception { | ||
| super.importTable_ShouldWorkProperly(); | ||
| } | ||
|
|
||
| @Test | ||
| @Override | ||
| @EnabledIf("isSqlite") | ||
| public void importTable_ForUnsupportedDatabase_ShouldThrowUnsupportedOperationException() | ||
| throws ExecutionException { | ||
| super.importTable_ForUnsupportedDatabase_ShouldThrowUnsupportedOperationException(); | ||
| } | ||
| } | ||
38 changes: 38 additions & 0 deletions
38
...com/scalar/db/storage/jdbc/ConsensusCommitImportTableIntegrationTestWithJdbcDatabase.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,38 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.transaction.consensuscommit.ConsensusCommitImportTableIntegrationTestBase; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.condition.DisabledIf; | ||
|
|
||
| @DisabledIf("isSqliteOrOracle") | ||
| public class ConsensusCommitImportTableIntegrationTestWithJdbcDatabase | ||
| extends ConsensusCommitImportTableIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| Properties properties = ConsensusCommitJdbcEnv.getProperties(testName); | ||
|
|
||
| // Set the isolation level for consistency reads for virtual tables | ||
| RdbEngineStrategy rdbEngine = | ||
| RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| properties.setProperty( | ||
| JdbcConfig.ISOLATION_LEVEL, | ||
| JdbcTestUtils.getIsolationLevel( | ||
| rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead()) | ||
| .name()); | ||
|
|
||
| return properties; | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new JdbcAdminTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @SuppressWarnings("unused") | ||
| private static boolean isSqliteOrOracle() { | ||
| return JdbcEnv.isSqlite() || JdbcEnv.isOracle(); | ||
| } | ||
| } |
38 changes: 38 additions & 0 deletions
38
...jdbc/ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase.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,38 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.transaction.consensuscommit.ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestBase; | ||
| import com.scalar.db.util.AdminTestUtils; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.condition.DisabledIf; | ||
|
|
||
| @DisabledIf("isSqliteOrOracle") | ||
| public class ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestWithJdbcDatabase | ||
| extends ConsensusCommitImportTableWithMetadataDecouplingIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| Properties properties = ConsensusCommitJdbcEnv.getProperties(testName); | ||
|
|
||
| // Set the isolation level for consistency reads for virtual tables | ||
| RdbEngineStrategy rdbEngine = | ||
| RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| properties.setProperty( | ||
| JdbcConfig.ISOLATION_LEVEL, | ||
| JdbcTestUtils.getIsolationLevel( | ||
| rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead()) | ||
| .name()); | ||
|
|
||
| return properties; | ||
| } | ||
|
|
||
| @Override | ||
| protected AdminTestUtils getAdminTestUtils(String testName) { | ||
| return new JdbcAdminTestUtils(getProperties(testName)); | ||
| } | ||
|
|
||
| @SuppressWarnings("unused") | ||
| private static boolean isSqliteOrOracle() { | ||
| return JdbcEnv.isSqlite() || JdbcEnv.isOracle(); | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
...ge/jdbc/ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestWithJdbcDatabase.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,27 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.transaction.consensuscommit.ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestBase; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.condition.DisabledIf; | ||
|
|
||
| @DisabledIf("com.scalar.db.storage.jdbc.JdbcEnv#isOracle") | ||
| public class ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestWithJdbcDatabase | ||
| extends ConsensusCommitSpecificWithMetadataDecouplingIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProperties(String testName) { | ||
| Properties properties = ConsensusCommitJdbcEnv.getProperties(testName); | ||
|
|
||
| // Set the isolation level for consistency reads for virtual tables | ||
| RdbEngineStrategy rdbEngine = | ||
| RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| properties.setProperty( | ||
| JdbcConfig.ISOLATION_LEVEL, | ||
| JdbcTestUtils.getIsolationLevel( | ||
| rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead()) | ||
| .name()); | ||
|
|
||
| return properties; | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
...db/storage/jdbc/ConsensusCommitWithMetadataDecouplingIntegrationTestWithJdbcDatabase.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,27 @@ | ||
| package com.scalar.db.storage.jdbc; | ||
|
|
||
| import com.scalar.db.config.DatabaseConfig; | ||
| import com.scalar.db.transaction.consensuscommit.ConsensusCommitWithMetadataDecouplingIntegrationTestBase; | ||
| import java.util.Properties; | ||
| import org.junit.jupiter.api.condition.DisabledIf; | ||
|
|
||
| @DisabledIf("com.scalar.db.storage.jdbc.JdbcEnv#isOracle") | ||
| public class ConsensusCommitWithMetadataDecouplingIntegrationTestWithJdbcDatabase | ||
| extends ConsensusCommitWithMetadataDecouplingIntegrationTestBase { | ||
|
|
||
| @Override | ||
| protected Properties getProps(String testName) { | ||
| Properties properties = ConsensusCommitJdbcEnv.getProperties(testName); | ||
|
|
||
| // Set the isolation level for consistency reads for virtual tables | ||
| RdbEngineStrategy rdbEngine = | ||
| RdbEngineFactory.create(new JdbcConfig(new DatabaseConfig(properties))); | ||
| properties.setProperty( | ||
| JdbcConfig.ISOLATION_LEVEL, | ||
| JdbcTestUtils.getIsolationLevel( | ||
| rdbEngine.getMinimumIsolationLevelForConsistentVirtualTableRead()) | ||
| .name()); | ||
|
|
||
| return properties; | ||
| } | ||
| } |
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
Oops, something went wrong.
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.