Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32180601
D15383.1765075523.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D15383.1765075523.diff
View Options
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteConnectionManager.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteConnectionManager.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteConnectionManager.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteConnectionManager.cpp
@@ -72,19 +72,66 @@
int getOperationResult = sqlite3changeset_op(
changesetIter, &tableName, &columnsNumber, &operationType, nullptr);
- handleSQLiteError(
- getOperationResult,
- "Failed to extract operation from log iterator.");
+
+ if (getOperationResult != SQLITE_OK) {
+ Logger::log(
+ "ERROR: Failed to extract operation from log iterator. Error: " +
+ std::string(sqlite3_errstr(getOperationResult)));
+ handleSQLiteError(
+ getOperationResult,
+ "Failed to extract operation from log iterator.");
+ }
+
+ std::string conflictReasonStr;
+ switch (conflictReason) {
+ case SQLITE_CHANGESET_DATA:
+ conflictReasonStr = "DATA";
+ break;
+ case SQLITE_CHANGESET_NOTFOUND:
+ conflictReasonStr = "NOTFOUND";
+ break;
+ case SQLITE_CHANGESET_CONFLICT:
+ conflictReasonStr = "CONFLICT";
+ break;
+ case SQLITE_CHANGESET_CONSTRAINT:
+ conflictReasonStr = "CONSTRAINT";
+ break;
+ case SQLITE_CHANGESET_FOREIGN_KEY:
+ conflictReasonStr = "FOREIGN_KEY";
+ break;
+ default:
+ conflictReasonStr =
+ "UNKNOWN(" + std::to_string(conflictReason) + ")";
+ break;
+ }
+
+ std::string operationTypeStr;
+ switch (operationType) {
+ case SQLITE_INSERT:
+ operationTypeStr = "INSERT";
+ break;
+ case SQLITE_DELETE:
+ operationTypeStr = "DELETE";
+ break;
+ case SQLITE_UPDATE:
+ operationTypeStr = "UPDATE";
+ break;
+ default:
+ operationTypeStr = "UNKNOWN(" + std::to_string(operationType) + ")";
+ break;
+ }
std::stringstream conflictMessage;
- conflictMessage << "Conflict of type " << conflictReason
- << " occurred for operation of type " << operationType
- << " for table " << tableName
- << " during backup log application";
+ conflictMessage << "CONFLICT: " << conflictReasonStr << " conflict"
+ << " for " << operationTypeStr << " operation"
+ << " on table '" << (tableName ? tableName : "NULL")
+ << "' (columns: " << columnsNumber << ")";
Logger::log(conflictMessage.str());
- if (operationType == SQLITE_INSERT &&
- conflictReason == SQLITE_CHANGESET_CONFLICT) {
+ if ((operationType == SQLITE_INSERT &&
+ conflictReason == SQLITE_CHANGESET_CONFLICT) ||
+ (operationType == SQLITE_DELETE &&
+ conflictReason == SQLITE_CHANGESET_DATA)) {
return SQLITE_CHANGESET_REPLACE;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 2:45 AM (8 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840876
Default Alt Text
D15383.1765075523.diff (3 KB)
Attached To
Mode
D15383: [native] Improve the logging when restoring logs. Handle a DELETE conflict.
Attached
Detach File
Event Timeline
Log In to Comment