Skip to content

Commit bffa212

Browse files
authored
Update C++ core (#83)
Notable changes: * OpenSSL and CentOS 7 (#382) * CXXCBC-144: Search query on collections should not require you to pass in the scope name (#379) * CXXCBC-145: Search query request raw option not used (#380) * CXXCBC-310: Transaction fit test errors (#378) * CXXCBC-194: Support ExtThreadSafe transaction extension. (#374, #376) * CXXCBC-316: Core txn get_optional after query issue (#385) * CXXCBC-310: Fixed race condition in transaction_context state machine (#386)
1 parent 5fd98ce commit bffa212

File tree

7 files changed

+32
-23
lines changed

7 files changed

+32
-23
lines changed

Couchbase/Transactions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function run(callable $logic, ?TransactionOptions $options = null): Trans
6363
$logic($transaction->transactionAttemptContext());
6464
} catch (Exception $exception) {
6565
$transaction->rollback();
66-
throw new TransactionFailedException("Exception caught during execution of transaction logic", 0, $exception);
66+
throw new TransactionFailedException("Exception caught during execution of transaction logic. " . $exception->getMessage(), 0, $exception);
6767
}
6868

6969
try {

config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PHP_ADD_MAKEFILE_FRAGMENT
3939
AC_CONFIG_COMMANDS_POST([
4040
echo "
4141
CMAKE : ${CMAKE}
42-
CMAKE_BUILD_TYPE : ${COUCHBASE_CMAKE_BUILD_TYPE:-RelWithDebInfo}
42+
CMAKE_BUILD_TYPE : ${COUCHBASE_CMAKE_BUILD_TYPE:-Release}
4343
CMAKE_SOURCE_DIRECTORY : ${COUCHBASE_CMAKE_SOURCE_DIRECTORY}
4444
CMAKE_BUILD_DIRECTORY : ${COUCHBASE_CMAKE_BUILD_DIRECTORY}
4545
CMAKE_C_COMPILER : ${CC}

package.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<email>sergey@couchbase.com</email>
1414
<active>yes</active>
1515
</lead>
16-
<date>2023-02-22</date>
16+
<date>2023-03-14</date>
1717
<version>
1818
<release>4.1.1</release>
1919
<api>4.0.0</api>
@@ -439,6 +439,7 @@
439439
<file role="src" name="build_config.hxx.in"/>
440440
<file role="src" name="build_version.hxx.in"/>
441441
<file role="src" name="test_filesystem.cpp.in"/>
442+
<file role="src" name="test_openssl.cxx"/>
442443
</dir>
443444
<dir name="core">
444445
<dir name="crypto">
@@ -530,6 +531,7 @@
530531
<file role="src" name="streaming_json_lexter_error_category.cxx"/>
531532
<file role="src" name="touch.cxx"/>
532533
<file role="src" name="transaction_error_category.cxx"/>
534+
<file role="src" name="transaction_get_result.cxx"/>
533535
<file role="src" name="transaction_op_error_category.cxx"/>
534536
<file role="src" name="unlock.cxx"/>
535537
<file role="src" name="upsert.cxx"/>

src/wrapper/core_error_info.hxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,19 @@ struct transactions_error_category : std::error_category {
159159

160160
[[nodiscard]] std::string message(int ev) const noexcept override
161161
{
162-
switch (transactions_errc(ev)) {
162+
switch (static_cast<transactions_errc>(ev)) {
163163
case transactions_errc::operation_failed:
164164
return "operation_failed";
165165
case transactions_errc::std_exception:
166166
return "std_exception";
167167
case transactions_errc::unexpected_exception:
168168
return "unexpected_exception";
169+
case transactions_errc::failed:
170+
return "failed";
171+
case transactions_errc::expired:
172+
return "expired";
173+
case transactions_errc::commit_ambiguous:
174+
return "commit_ambiguous";
169175
}
170176
return "FIXME: unknown error code in transactions category (recompile with newer library)";
171177
}

src/wrapper/transaction_context_resource.cxx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ zval_to_links(const zval* document)
566566
std::optional<std::string> atr_collection_name;
567567
std::optional<std::string> staged_transaction_id;
568568
std::optional<std::string> staged_attempt_id;
569+
std::optional<std::string> staged_operation_id;
569570
std::optional<std::vector<std::byte>> staged_content;
570571
std::optional<std::string> cas_pre_txn;
571572
std::optional<std::string> revid_pre_txn;
@@ -581,6 +582,7 @@ zval_to_links(const zval* document)
581582
cb_assign_string(atr_collection_name, links, "atr_collection_name");
582583
cb_assign_string(staged_transaction_id, links, "staged_transaction_id");
583584
cb_assign_string(staged_attempt_id, links, "staged_attempt_id");
585+
cb_assign_string(staged_operation_id, links, "staged_operation_id");
584586
cb_assign_binary(staged_content, links, "staged_content");
585587
cb_assign_string(cas_pre_txn, links, "cas_pre_txn");
586588
cb_assign_string(revid_pre_txn, links, "revid_pre_txn");
@@ -595,21 +597,22 @@ zval_to_links(const zval* document)
595597
forward_compat_json = core::utils::json::parse(forward_compat.value());
596598
}
597599

598-
core::transactions::transaction_links links_(atr_id,
599-
atr_bucket_name,
600-
atr_scope_name,
601-
atr_collection_name,
602-
staged_transaction_id,
603-
staged_attempt_id,
604-
staged_content,
605-
cas_pre_txn,
606-
revid_pre_txn,
607-
exptime_pre_txn,
608-
crc32_of_staging,
609-
op,
610-
forward_compat_json,
611-
is_deleted);
612-
return { links_, {} };
600+
return { core::transactions::transaction_links{ atr_id,
601+
atr_bucket_name,
602+
atr_scope_name,
603+
atr_collection_name,
604+
staged_transaction_id,
605+
staged_attempt_id,
606+
staged_operation_id,
607+
staged_content,
608+
cas_pre_txn,
609+
revid_pre_txn,
610+
exptime_pre_txn,
611+
crc32_of_staging,
612+
op,
613+
forward_compat_json,
614+
is_deleted },
615+
{} };
613616
}
614617

615618
static std::pair<std::optional<core::transactions::document_metadata>, core_error_info>

tests/TransactionsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ function (TransactionAttemptContext $attempt) use ($idToRemove, $idToReplace, $i
235235
function () use ($idToRemove, $collection, $attempt) {
236236
$attempt->get($collection, $idToRemove);
237237
},
238-
TransactionException::class,
239-
null,
240-
"/doc not found/"
238+
Couchbase\Exception\DocumentNotFoundException::class
241239
);
242240
}
243241
);

0 commit comments

Comments
 (0)