Skip to content

Commit 72ece36

Browse files
committed
exmdb: adjust event notifications in the face of soft-deletion actions
Creating a message in a folder not only updates a content table showing the normal set, but also a CT showing the softdeleted set. That ought not to happen. References: GXL-337
1 parent eb67380 commit 72ece36

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

exch/exmdb/db_engine.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,14 @@ static void dbeng_notify_cttbl_add_row(db_conn *pdb,
16791679
if (!cu_get_property(MAPI_MESSAGE, message_id, CP_ACP,
16801680
pdb->psqlite, PR_ASSOCIATED, &pvalue0))
16811681
return;
1682+
char qstr[256];
1683+
snprintf(qstr, std::size(qstr), "SELECT is_deleted FROM messages WHERE message_id=%llu", LLU{message_id});
1684+
auto stm = pdb->prep(qstr);
1685+
if (stm == nullptr)
1686+
return;
1687+
auto b_del = stm.step() != SQLITE_ROW || stm.col_uint64(0) != 0;
1688+
stm.finalize();
1689+
16821690
std::unique_ptr<prepared_statements> optim;
16831691
BOOL b_fai = pvb_enabled(pvalue0) ? TRUE : false;
16841692
auto sql_transact_eph = gx_sql_begin(pdb->m_sqlite_eph, txn_mode::write);
@@ -1693,6 +1701,8 @@ static void dbeng_notify_cttbl_add_row(db_conn *pdb,
16931701
continue;
16941702
if (!!(ptable->table_flags & TABLE_FLAG_ASSOCIATED) == !b_fai)
16951703
continue;
1704+
if (!!(ptable->table_flags & TABLE_FLAG_SOFTDELETES) == !b_del)
1705+
continue;
16961706
if (dbase.tables.b_batch && ptable->b_hint)
16971707
continue;
16981708
if (ptable->prestriction != nullptr &&

exch/exmdb/message.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ BOOL exmdb_server::delete_messages(const char *dir, cpid_t cpid,
630630
const TPROPVAL_ARRAY npropds = {std::size(nprop), nprop};
631631
cu_set_properties(MAPI_MESSAGE, tmp_val, CP_ACP, pdb->psqlite,
632632
&npropds, &problems);
633+
634+
/* For GCT(SHOW_SOFTDELETES), this is a new message now */
635+
pdb->notify_message_creation(src_val, tmp_val, *dbase, notifq);
633636
}
634637
if (!b_hard && !is_private()) {
635638
char sql_string[256];

0 commit comments

Comments
 (0)