Conversation
only file deleting is left at post DFW stage. Added missed object type of TABLESPACES. Added security class for tablespaces which allows not to skip check of the privileges. Corrected page space before fetching of the root index page.
…code as for deleting a table. NOTE: Now we fire DDL trigger for deleling tables even if they are deleting as result of DROP TABLESPACE ... INCLUDING CONTENTS
…nt of usage have the page space in the pace space manager. Also the same behaviour has been ported to the expression index handling.
The recent change added a couple of new fields into CreationIndex which were not initialized before fast loading while index moving.
…RELATION_ID is NULL in that case
…g, adding and deleting page spaces
…espace creation Page space should be added into pageSpaces array after creating/opening of tablespace file to prevent other attachments from getting incomplete page space.
…ME> INCLUDING CONTENTS. Deleting from tablespaces cache is implemented.
…e rollback work correctly. The file will be created at DFW stage
…opped in the same transaction
… A relation may already be deleted by dfw_delete_relation in the same transaction
It allows to determine if there are attachments that use a tablespace (and have its page space opened) when another attachment needs the EX lock on that tablespace (for example, to execute ALTER TABLESPACE).
… make it work correctly
…file containing an index is unsuccessful
…rash while trying to write dirty pages of closed tablespace to disk
…ropped in the same transaction
| ALTER INDEX ... | ||
| [SET TABLESPACE [TO] {<TS NAME> | PRIMARY}] | ||
|
|
||
| The index data will be moved to the specified tablespace or to the main database. |
There was a problem hiding this comment.
May be to add about necessary locks for the index movement.
|
|
||
| ALTER TABLE <TABLE NAME> SET TABLESPACE [TO] {<TS NAME> | PRIMARY} | ||
|
|
||
| The table data will be moved to the specified tablespace or to the main database. |
There was a problem hiding this comment.
May be add about necessary locks for the table's data movement
| If you do not specify the above options, when restoring a database that has tablespaces, | ||
| an error about the inability to determine the path to restore tablespaces will occur. | ||
|
|
||
| 3. Show |
| - allocate necessary number of pointer pages by extents. | ||
| - allocate the rest of pointer pages by pages. | ||
| - walking through PPs allocate DPs by pages or extents. | ||
| - fix every PP by correcting DP numbers and ppg_next pointer and build a map |
There was a problem hiding this comment.
still allocate new data pages on demand for data pages with "orphan" flags which are not in the PP.
| return status->getState() & IStatus::STATE_ERRORS ? true : false; | ||
| } | ||
|
|
||
| static bool drop_files(ObjectsArray<PathName>& tsFiles) |
There was a problem hiding this comment.
Just "files" is better than "tsFiles".
There was a problem hiding this comment.
Fixed and slightly refactored to simplify the code even more.
| } | ||
| } | ||
|
|
||
| ULONG pageSpaceId = DB_PAGE_SPACE; |
There was a problem hiding this comment.
The same code as above. New function or lambda?
| MetaName name; | ||
|
|
||
| if (pageSpaceId == 0) | ||
| name = TEMP_TABLESPACE_NAME; |
There was a problem hiding this comment.
Maybe to move the logic under Tablespace::lookup?
| Tablespace* get(ULONG id); | ||
| Tablespace* get(const MetaName& name); | ||
|
|
||
| void store(Tablespace* tabpeSpace); |
| Firebird::Mutex m_mutex; | ||
| }; | ||
|
|
||
| explicit Tablespace(MemoryPool& pool, ULONG id = DB_PAGE_SPACE) |
There was a problem hiding this comment.
There is no backward compatibility, so maybe better not to use default value for id?
There was a problem hiding this comment.
Replaced with an explicit ID passed (only a single place is affected)
|
|
||
| if (tableSpace.hasData() && applyTablespacesDdl(tdbb)) | ||
| { | ||
| if ((tableSpace != PRIMARY_TABLESPACE_NAME) && |
There was a problem hiding this comment.
Here and later Is this check is necessary? AFAIU checkObjectExist takes into account special case that tablespace is PRIMARY.
There was a problem hiding this comment.
Simplified and made consistent with the handling of other object types.
…w tablespace. Some misc corrections.
…rrections. Remove the redundant code.
|
I've addressed most of the review comments, a few are still in the pipeline and will be finished this week. |
… pagespace iteration in the validation code. More explicit pagespace ID range handling.
|
For |
|
|
||
| 4. 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 not be ignored on the replica and |
Link to proposal: https://groups.google.com/g/firebird-devel/c/geF0A2_kC28