Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/include/main/database.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct LBUG_API SystemConfig {
* WAL file. It must match the setting the database's WAL was written with: a mismatch fails
* the open whatever throwOnWalReplayFailure says.
* @param enableMultiWrites If true, multiple concurrent write transactions are allowed.
* Default to false.
* Default to true.
* @param enableDefaultHashIndex If true, node tables create the default primary-key hash
* index.
* @param physicalPlanPoolPerThread How many reusable cloned physical plans each thread
Expand All @@ -81,7 +81,7 @@ struct LBUG_API SystemConfig {
bool enableCompression = true, bool readOnly = false, uint64_t maxDBSize = -1u,
bool autoCheckpoint = true, uint64_t checkpointThreshold = 16777216 /* 16MB */,
bool forceCheckpointOnClose = true, bool throwOnWalReplayFailure = false,
bool enableChecksums = true, bool enableMultiWrites = false,
bool enableChecksums = true, bool enableMultiWrites = true,
bool enableDefaultHashIndex = true, uint64_t physicalPlanPoolPerThread = 5
#if defined(__APPLE__)
,
Expand Down
4 changes: 2 additions & 2 deletions src/include/main/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ struct RecursivePatternFactorSetting {
static common::Value getSetting(const ClientContext* context);
};

struct EnableMVCCSetting {
static constexpr auto name = "debug_enable_multi_writes";
struct EnableMultiWritesSetting {
static constexpr auto name = "enable_multi_writes";
static constexpr auto inputType = common::LogicalTypeID::BOOL;
static void setContext(ClientContext* context, const common::Value& parameter);
static common::Value getSetting(const ClientContext* context);
Expand Down
2 changes: 1 addition & 1 deletion src/main/db_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static ConfigurationOption options[] = { // NOLINT(cert-err58-cpp):
GET_CONFIGURATION(DisableMapKeyCheck), GET_CONFIGURATION(EnableZoneMapSetting),
GET_CONFIGURATION(HomeDirectorySetting), GET_CONFIGURATION(FileSearchPathSetting),
GET_CONFIGURATION(ProgressBarSetting), GET_CONFIGURATION(RecursivePatternSemanticSetting),
GET_CONFIGURATION(RecursivePatternFactorSetting), GET_CONFIGURATION(EnableMVCCSetting),
GET_CONFIGURATION(RecursivePatternFactorSetting), GET_CONFIGURATION(EnableMultiWritesSetting),
GET_CONFIGURATION(CheckpointThresholdSetting), GET_CONFIGURATION(AutoCheckpointSetting),
GET_CONFIGURATION(ForceCheckpointClosingDBSetting),
GET_CONFIGURATION(EnableDefaultHashIndexSetting), GET_CONFIGURATION(SpillToDiskSetting),
Expand Down
5 changes: 2 additions & 3 deletions src/main/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,12 @@ common::Value RecursivePatternFactorSetting::getSetting(const ClientContext* con
context->getClientConfig()->recursivePatternCardinalityScaleFactor);
}

void EnableMVCCSetting::setContext(ClientContext* context, const common::Value& parameter) {
void EnableMultiWritesSetting::setContext(ClientContext* context, const common::Value& parameter) {
DASSERT(parameter.getDataType().getLogicalTypeID() == common::LogicalTypeID::BOOL);
// TODO: This is a temporary solution to make tests of multiple write transactions easier.
context->getDBConfigUnsafe()->enableMultiWrites = parameter.getValue<bool>();
}

common::Value EnableMVCCSetting::getSetting(const ClientContext* context) {
common::Value EnableMultiWritesSetting::getSetting(const ClientContext* context) {
return common::Value(context->getDBConfig()->enableMultiWrites);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
16|propA|INT64|False

-CASE ConcurrentMultiWriteCreateTable
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_CONNECTION conn2
-CREATE_CONNECTION conn3
Expand All @@ -75,7 +75,7 @@
#TODO(Howe): After fixing, please update table_info to return default_expr aswell.

-CASE ConcurrentMultiWriteAlter
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_CONNECTION conn2
-CREATE_CONNECTION conn3
Expand Down
16 changes: 10 additions & 6 deletions test/test_files/transaction/concurrency/ddl_serial_execution.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
--

-CASE MultiWritesException
-STATEMENT CALL enable_multi_writes=false;
---- ok
-STATEMENT BEGIN TRANSACTION;
---- ok
-STATEMENT CREATE NODE TABLE t(a INT, b INT, PRIMARY KEY(a));
Expand Down Expand Up @@ -49,9 +51,11 @@ Cannot start a new write transaction in the system. Only one write transaction a
---- 1
2

# Test CALL debug_enable_multi_writes=true
# Test CALL enable_multi_writes=false/true toggle
-CASE EnableMultiWrites
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=false;
---- ok
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT BEGIN TRANSACTION;
---- ok
Expand Down Expand Up @@ -109,7 +113,7 @@ Catalog exception: t does not exist in catalog.

# Test W-W conflict
-CASE CreateTableWriteWriteConflict
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT BEGIN TRANSACTION;
---- ok
Expand Down Expand Up @@ -190,7 +194,7 @@ Catalog exception: t does not exist in catalog.
1|b|INT32|NULL|False

-CASE CreateAndDropMultiConnections
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT BEGIN TRANSACTION;
---- ok
Expand Down Expand Up @@ -238,7 +242,7 @@ Binder exception: Table t does not exist.
1|b|INT32|NULL|False

-CASE RenameTable
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT BEGIN TRANSACTION;
---- ok
Expand Down Expand Up @@ -275,7 +279,7 @@ Catalog exception: t does not exist in catalog.
1|b|INT32|NULL|False

-CASE RenameColumn
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT CALL auto_checkpoint=false;
---- ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]

-CASE WWConflictNodeCopyUpdate
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_PERSON
-CREATE_CONNECTION conn2
Expand All @@ -35,7 +35,7 @@
Runtime exception: Write-write conflict of updating the same row.

-CASE NodeUpdateOverlappedRows
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_CONNECTION conn2
-STATEMENT CREATE NODE TABLE test(id INT64, val INT64, PRIMARY KEY(id));
Expand Down Expand Up @@ -65,7 +65,7 @@ Runtime exception: Write-write conflict of updating the same row.
21

-CASE NodeUpdatesRollback
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT CALL auto_checkpoint=false;
---- ok
Expand Down Expand Up @@ -95,7 +95,7 @@ Runtime exception: Write-write conflict of updating the same row.
0

-CASE NodeUpdatesMixedCommitAndRollback
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT CALL auto_checkpoint=false;
---- ok
Expand Down Expand Up @@ -146,7 +146,7 @@ Runtime exception: Write-write conflict of updating the same row.
100

-CASE WWConflictNodeCopyDelete
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_PERSON
-CREATE_CONNECTION conn2
Expand All @@ -161,7 +161,7 @@ Runtime exception: Write-write conflict of updating the same row.
Runtime exception: Write-write conflict: deleting a row that is already deleted by another transaction.

-CASE WWConflictRelCopyUpdate
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_PERSON
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_KNOWS
Expand All @@ -177,7 +177,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted
Runtime exception: Write-write conflict of updating the same row.

-CASE WWConflictRelCopyDelete
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_PERSON
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_KNOWS
Expand All @@ -193,7 +193,7 @@ Runtime exception: Write-write conflict of updating the same row.
Runtime exception: Write-write conflict: deleting a row that is already deleted by another transaction.

-CASE WWConflictNodeInsertUpdate
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_DATASET_SCHEMA tinysnb
-INSERT_DATASET_BY_ROW tinysnb
Expand All @@ -209,7 +209,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted
Runtime exception: Write-write conflict of updating the same row.

-CASE WWConflictNodeInsertDelete
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_DATASET_SCHEMA tinysnb
-INSERT_DATASET_BY_ROW tinysnb
Expand All @@ -225,7 +225,7 @@ Runtime exception: Write-write conflict of updating the same row.
Runtime exception: Write-write conflict: deleting a row that is already deleted by another transaction.

-CASE WWConflictRelInsertUpdate
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_DATASET_SCHEMA tinysnb
-INSERT_DATASET_BY_ROW tinysnb
Expand All @@ -241,7 +241,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted
Runtime exception: Write-write conflict of updating the same row.

-CASE WWConflictRelInsertDelete
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_DATASET_SCHEMA tinysnb
-INSERT_DATASET_BY_ROW tinysnb
Expand All @@ -257,7 +257,7 @@ Runtime exception: Write-write conflict of updating the same row.
Runtime exception: Write-write conflict: deleting a row that is already deleted by another transaction.

-CASE MultiTransactionNodeInsert
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT CALL auto_checkpoint=false;
---- ok
Expand Down Expand Up @@ -311,7 +311,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted
10

-CASE MultiTransactionRelInsert
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT CALL auto_checkpoint=false;
---- ok
Expand Down Expand Up @@ -386,7 +386,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted

-CASE MultiTransactionNodeCopy
-SKIP
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-STATEMENT create node table person (ID INt64, fName StRING, gender INT64, isStudent BoOLEAN, isWorker BOOLEAN, age INT64, eyeSight DOUBLE, birthdate DATE, registerTime TIMESTAMP, lastJobDuration interval, workedHours INT64[], usedNames STRING[], courseScoresPerTerm INT64[][], grades INT64[4], height float, u UUID, PRIMARY KEY (ID));
---- ok
Expand Down Expand Up @@ -435,7 +435,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted

-CASE MultiTransactionRelCopy
-SKIP
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_PERSON
-STATEMENT create rel table knows (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], summary STRUCT(locations STRING[], transfer STRUCT(day DATE, amount INT64[])), notes UNION(firstmet DATE, type INT16, comment STRING), someMap MAP(STRING, STRING), MANY_MAnY);
Expand Down Expand Up @@ -502,7 +502,7 @@ Runtime exception: Write-write conflict: deleting a row that is already deleted

-CASE MixedMultiTransactionRelCopyInsert
-SKIP
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-INSERT_STATEMENT_BLOCK COPY_TINYSNB_PERSON
-STATEMENT create rel table knows (FROM person TO person, date DATE, meetTime TIMESTAMP, validInterval INTERVAL, comments STRING[], summary STRUCT(locations STRING[], transfer STRUCT(day DATE, amount INT64[])), notes UNION(firstmet DATE, type INT16, comment STRING), someMap MAP(STRING, STRING), MANY_MAnY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

-CASE ConcurrentSingleWriteUpdate
-SKIP_WASM
-STATEMENT CALL debug_enable_multi_writes=true;
-STATEMENT CALL enable_multi_writes=true;
---- ok
-CREATE_CONNECTION conn2
-BEGIN_CONCURRENT_EXECUTION
Expand Down
10 changes: 5 additions & 5 deletions test/transaction/checkpoint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3007,7 +3007,7 @@ TEST_F(FlakyCheckpointerTest, ConcurrentDropGraphDuringCommitKeepsCatalogsAlive)
}
ASSERT_TRUE(conn->query("CALL force_checkpoint_on_close=false;")->isSuccess());
ASSERT_TRUE(conn->query("CALL auto_checkpoint=false;")->isSuccess());
ASSERT_TRUE(conn->query("CALL debug_enable_multi_writes=true;")->isSuccess());
ASSERT_TRUE(conn->query("CALL enable_multi_writes=true;")->isSuccess());
main::Connection dropConn(database.get());
constexpr auto iterations = 100;
for (auto i = 0; i < iterations; ++i) {
Expand Down Expand Up @@ -3943,7 +3943,7 @@ TEST_F(FlakyCheckpointerTest, ConcurrentDropGraphDuringStagedInsertCommitFailsCl
}
ASSERT_TRUE(conn->query("CALL force_checkpoint_on_close=false;")->isSuccess());
ASSERT_TRUE(conn->query("CALL auto_checkpoint=false;")->isSuccess());
ASSERT_TRUE(conn->query("CALL debug_enable_multi_writes=true;")->isSuccess());
ASSERT_TRUE(conn->query("CALL enable_multi_writes=true;")->isSuccess());
main::Connection dropConn(database.get());

auto stageRelInsert = [&] {
Expand Down Expand Up @@ -4966,7 +4966,7 @@ TEST_F(ReviewFixesTest, CheckpointDrainWaitsForInFlightWrite) {
GTEST_SKIP();
}
conn->query("CALL auto_checkpoint=false;");
conn->query("CALL debug_enable_multi_writes=true;");
conn->query("CALL enable_multi_writes=true;");
conn->query("CREATE NODE TABLE drain_test(id INT64 PRIMARY KEY);");

// Pre-load N committed rows so the table is non-trivial.
Expand Down Expand Up @@ -7130,7 +7130,7 @@ TEST_F(ReviewFixesTest, DroppedGraphLivenessIdentityRemovedAtDrop) {
TEST_F(ReviewFixesTest, RollbackSkipsDroppedGraphCatalogEntryUndo) {
conn->query("CALL auto_checkpoint=false;");
conn->query("CALL force_checkpoint_on_close=false;");
conn->query("CALL debug_enable_multi_writes=true;");
conn->query("CALL enable_multi_writes=true;");
ASSERT_TRUE(conn->query("CREATE GRAPH live_graph;")->isSuccess());
ASSERT_TRUE(conn->query("CREATE GRAPH doomed_graph;")->isSuccess());

Expand Down Expand Up @@ -7171,7 +7171,7 @@ TEST_F(ReviewFixesTest, RollbackSkipsDroppedGraphCatalogEntryUndo) {
TEST_F(ReviewFixesTest, RollbackSkipsDroppedGraphSequenceUndo) {
conn->query("CALL auto_checkpoint=false;");
conn->query("CALL force_checkpoint_on_close=false;");
conn->query("CALL debug_enable_multi_writes=true;");
conn->query("CALL enable_multi_writes=true;");
ASSERT_TRUE(conn->query("CREATE GRAPH live_graph;")->isSuccess());
ASSERT_TRUE(conn->query("CREATE GRAPH doomed_graph;")->isSuccess());
ASSERT_TRUE(conn->query("USE GRAPH live_graph;")->isSuccess());
Expand Down
Loading
Loading