MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / create

Method create

src/jrd/replication/Applier.cpp:228–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226
227
228Applier* Applier::create(thread_db* tdbb)
229{
230 const auto dbb = tdbb->getDatabase();
231
232 if (!dbb->isReplica())
233 raiseError("Database is not in the replica mode");
234
235 const auto attachment = tdbb->getAttachment();
236
237 if (!attachment->locksmith(tdbb, REPLICATE_INTO_DATABASE))
238 status_exception::raise(Arg::Gds(isc_miss_prvlg) << "REPLICATE_INTO_DATABASE");
239
240 Request* request = nullptr;
241 const auto req_pool = attachment->createPool();
242
243 try
244 {
245 Jrd::ContextPoolHolder context(tdbb, req_pool);
246 AutoPtr<CompilerScratch> csb(FB_NEW_POOL(*req_pool) CompilerScratch(*req_pool));
247
248 request = Statement::makeRequest(tdbb, csb, true);
249 request->validateTimeStamp();
250 request->req_attachment = attachment;
251 }
252 catch (const Exception&)
253 {
254 if (request)
255 CMP_release(tdbb, request);
256 else
257 attachment->deletePool(req_pool);
258
259 throw;
260 }
261
262 const auto config = dbb->replConfig();
263 const bool cascade = (config && config->cascadeReplication);
264
265 const auto applier = FB_NEW_POOL(*attachment->att_pool)
266 Applier(*attachment->att_pool, dbb->dbb_filename, request, cascade);
267
268 attachment->att_repl_appliers.add(applier);
269
270 return applier;
271}
272
273void Applier::shutdown(thread_db* tdbb)
274{

Callers

nothing calls this directly

Calls 14

raiseFunction · 0.85
GdsClass · 0.85
CMP_releaseFunction · 0.85
getDatabaseMethod · 0.80
isReplicaMethod · 0.80
validateTimeStampMethod · 0.80
replConfigMethod · 0.80
raiseErrorFunction · 0.70
ApplierClass · 0.70
getAttachmentMethod · 0.45
locksmithMethod · 0.45
createPoolMethod · 0.45

Tested by

no test coverage detected