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

Function SHUT_online

src/jrd/shut.cpp:340–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338
339
340void SHUT_online(thread_db* tdbb, SSHORT flag, Sync* guard)
341{
342/**************************************
343 *
344 * S H U T _ o n l i n e
345 *
346 **************************************
347 *
348 * Functional description
349 * Move database to "more online" state
350 *
351 **************************************/
352 SET_TDBB(tdbb);
353 Database* const dbb = tdbb->getDatabase();
354 Jrd::Attachment* const attachment = tdbb->getAttachment();
355
356 // Only platform's user locksmith can shutdown or bring online a database
357
358 if (!attachment->locksmith(tdbb, CHANGE_SHUTDOWN_MODE))
359 {
360 ERR_post_nothrow(Arg::Gds(isc_no_priv) << "bring online" << "database" << dbb->dbb_filename);
361 if (attachment->att_user && attachment->att_user->testFlag(USR_mapdown))
362 ERR_post_nothrow(Arg::Gds(isc_map_down));
363 ERR_punt();
364 }
365
366 const int shut_mode = flag & isc_dpb_shut_mode_mask;
367
368 // Check if requested shutdown mode is valid
369 switch (shut_mode)
370 {
371 case isc_dpb_shut_normal:
372 if (!(dbb->dbb_ast_flags & DBB_shutdown))
373 {
374 same_mode(dbb); // normal -> normal
375 return;
376 }
377 break;
378 case isc_dpb_shut_multi:
379 if (!(dbb->dbb_ast_flags & DBB_shutdown))
380 {
381 bad_mode(dbb); // normal -> multi
382 }
383 if (!(dbb->dbb_ast_flags & DBB_shutdown_full) && !(dbb->dbb_ast_flags & DBB_shutdown_single))
384 {
385 same_mode(dbb); // multi -> multi
386 return;
387 }
388 break;
389 case isc_dpb_shut_single:
390 if (dbb->dbb_ast_flags & DBB_shutdown_single)
391 {
392 same_mode(dbb); //single -> single
393 return;
394 }
395 if (!(dbb->dbb_ast_flags & DBB_shutdown_full))
396 {
397 bad_mode(dbb); // !full -> single

Callers 1

internalAttachMethod · 0.85

Calls 15

SET_TDBBFunction · 0.85
ERR_post_nothrowFunction · 0.85
GdsClass · 0.85
ERR_puntFunction · 0.85
same_modeFunction · 0.85
bad_modeFunction · 0.85
check_backup_stateFunction · 0.85
CCH_FETCHFunction · 0.85
CCH_MARK_MUST_WRITEFunction · 0.85
CCH_RELEASEFunction · 0.85
notify_shutdownFunction · 0.85
CCH_release_exclusiveFunction · 0.85

Tested by

no test coverage detected