Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion doc/README.tablespaces
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,39 @@ UTILITIES

3. ISQL
SHOW {TABLESPACES | TABLESPACE <TS NAME>}

Displays a list of all tablespaces names in alphabetical order or information about the specified tablespace.

4. Replication
4. GSTAT
-ts [tablespace ...]
Reports the tablespaces and limits the analysis to the objects located in them.
Without tablespace names all user-defined tablespaces are reported.
The names are case sensitive, "PRIMARY" can be used to reference the main database file,
and an unknown name is reported as an error.
Tablespace names are accepted only after the database name, like the names of -t and -sch.
Used before it, the switch takes the next argument as a name and reports an error if that
leaves no database name.
The switch combines with the other ones: -ts selects the locations, -t and -sch select
the objects, and both are applied.

Before the analysis a "Tablespaces:" section lists every reported tablespace, in ascending
order of their IDs, with the file where it is located, its size and the tables and indices it
contains. The size is given in pages: the total number of the pages in the file and the number
of the allocated ones, that is, the pages used by the system (the header, inventory and SCN
pages) and by the objects.

A tablespace containing no objects is marked as empty. The tables are listed even when their
data pages are not analyzed (for example, with -ts -i), because their location is known
from the metadata. When no tablespace matches the selection, the section is not printed.

A table whose data is located outside the selected tablespaces is still reported when one of
its indices matches the selection, but its data pages are not analyzed.

The same is available through the services API, using the action_db_stats options
sts_tablespace <tablespace> (can be repeated) and sts_user_tablespaces, the latter being
equivalent to -ts without names.

5. Replication
There is an apply_tablespaces_ddl parameter for replication, it may be configured for the replica side.
If this parameter is disabled, CREATE/ALTER/DROP TSABLESPACE statements will be ignored on the replica and
tablespace-related clauses in CREATE/ALTER TABLE/INDEX statements will also be ignored.
Expand Down
2 changes: 2 additions & 0 deletions src/common/IntlParametersBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ IntlParametersBlock::TagType IntlSpbStart::checkTag(UCHAR tag, const char** tagN
return TAG_STRING;
FB_IPB_TAG(isc_spb_sts_schema);
return TAG_STRING;
FB_IPB_TAG(isc_spb_sts_tablespace);
return TAG_STRING;
FB_IPB_TAG(isc_spb_command_line);
return TAG_COMMAND_LINE;
}
Expand Down
1 change: 1 addition & 0 deletions src/common/classes/ClumpletReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ ClumpletReader::ClumpletType ClumpletReader::getClumpletType(UCHAR tag) const
case isc_spb_command_line:
case isc_spb_sts_table:
case isc_spb_sts_schema:
case isc_spb_sts_tablespace:
return StringSpb;
case isc_spb_options:
return IntSpb;
Expand Down
2 changes: 2 additions & 0 deletions src/include/firebird/impl/consts_pub.h
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@

#define isc_spb_sts_table 64
#define isc_spb_sts_schema 65
#define isc_spb_sts_tablespace 66

#define isc_spb_sts_data_pages 0x01
#define isc_spb_sts_db_log 0x02
Expand All @@ -633,6 +634,7 @@
//#define isc_spb_sts_table 0x40
#define isc_spb_sts_nocreation 0x80
#define isc_spb_sts_encryption 0x100
#define isc_spb_sts_user_tablespaces 0x200

/***********************************/
/* Server configuration key values */
Expand Down
5 changes: 5 additions & 0 deletions src/include/firebird/impl/msg/gstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ FB_IMPL_MSG_NO_SYMBOL(GSTAT, 64, " Level @1: @2, total length: @3, blob p
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 65, " -sch schemaname <schemaname2...> (case sensitive)")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 66, "option -sch needs a schema name")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 67, "option -sch got a too long schema name @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 68, " -ts tablespacename <tablespacename2...> (case sensitive)")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 69, "option -ts accepts several tablespace names only if used after <database>")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 70, "tablespace @1 not found")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 71, "option -ts got a too long tablespace name @1")
FB_IMPL_MSG_NO_SYMBOL(GSTAT, 72, "found ambiguity between the object name and the database name for option -@1")
2 changes: 2 additions & 0 deletions src/include/gen/Firebird.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4624,6 +4624,7 @@ IPerformanceStatsImpl = class(IPerformanceStats)
isc_spb_num_db = byte(6);
isc_spb_sts_table = byte(64);
isc_spb_sts_schema = byte(65);
isc_spb_sts_tablespace = byte(66);
isc_spb_sts_data_pages = $01;
isc_spb_sts_db_log = $02;
isc_spb_sts_hdr_pages = $04;
Expand All @@ -4632,6 +4633,7 @@ IPerformanceStatsImpl = class(IPerformanceStats)
isc_spb_sts_record_versions = $20;
isc_spb_sts_nocreation = $80;
isc_spb_sts_encryption = $100;
isc_spb_sts_user_tablespaces = $200;
isc_spb_nbk_level = byte(5);
isc_spb_nbk_file = byte(6);
isc_spb_nbk_direct = byte(7);
Expand Down
1 change: 1 addition & 0 deletions src/jrd/svc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2876,6 +2876,7 @@ bool Service::process_switches(ClumpletReader& spb, string& switches)
{
case isc_spb_sts_table:
case isc_spb_sts_schema:
case isc_spb_sts_tablespace:
if (!get_action_svc_parameter(spb.getClumpTag(), dba_in_sw_table, switches))
{
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/utilities/fbsvcmgr/fbsvcmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,13 @@ constexpr SvcSwitches statisticsOptions[] =
{"sts_nocreation", putOption, 0, isc_spb_sts_nocreation, 0},
{"sts_schema", putStringArgument, 0, isc_spb_sts_schema, 0},
{"sts_table", putStringArgument, 0, isc_spb_sts_table, 0},
{"sts_tablespace", putStringArgument, 0, isc_spb_sts_tablespace, 0},
{"sts_data_pages", putOption, 0, isc_spb_sts_data_pages, 0},
{"sts_hdr_pages", putOption, 0, isc_spb_sts_hdr_pages, 0},
{"sts_idx_pages", putOption, 0, isc_spb_sts_idx_pages, 0},
{"sts_sys_relations", putOption, 0, isc_spb_sts_sys_relations, 0},
{"sts_encryption", putOption, 0, isc_spb_sts_encryption, 0},
{"sts_user_tablespaces", putOption, 0, isc_spb_sts_user_tablespaces, 0},
{0, 0, 0, 0, 0}
};

Expand Down
Loading
Loading