Summary:
This is the first part of [#27669: DocDB Fix OID counter(s) after importing system catalog snapshot](https://github.com/yugabyte/yugabyte-db/issues/27669).
Here we ensure that during a restore or clone operation, the resulting databases have their normal space OID counter higher than any OID in use by a table.
This prevents problems where dropping a table with an OID higher than the counter can cause CREATE TABLE to fail later.
See the parent issue above for an example of this.
Note that I think there is some chance we might backport this before xCluster introduced reserved OIDs spaces so I am being careful not to change too much code in this diff. The next diff will complete the work needed to handle the OID counter advancement for xCluster. In the meantime I am leaving a todo:
```
~/code/yugabyte-db/src/yb/master/catalog_manager.h:758:
// Advance OID counters as needed to ensure future OID allocations do not run into trouble.
//
// So far this just ensures the normal space OID counter is beyond any normal-space OID we need to
// preserve.
// TODO(#27944): also handle reserved space and OIDs used by hidden tables.
Status AdvanceOidCounters(NamespaceId namespace_id);
```
and not renaming the xCluster function below; I will rename that in the next diff to be more correct given the changes we are making.
```
~/code/yugabyte-db/src/yb/master/xcluster/xcluster_source_manager.cc:543:
Status XClusterSourceManager::SetNormalOidCounterAboveAllNormalOids(NamespaceId namespace_id) {
RETURN_NOT_OK(catalog_manager_.AdvanceOidCounters(namespace_id));
```
I have modified the xCluster code to use the new AdvanceOidCounters routine; that code does the same as what the previous xCluster code did, however, so this diff doesn't change what happens when xCluster checkpointing is done.
Fixes #27943
Jira: DB-17558
Test Plan:
I have introduced new integration tests for the two failure cases, namely after restore and after clone:
```
ybd release --cxx-test yb-backup-cross-feature-test --gtest_filter '*.TestOidsAdvancedAfterRestore'
ybd release --cxx-test minicluster-snapshot-test --gtest_filter '*.TestOidsAdvancedAfterClone'
```
I have verified that each of these tests fail if I do not advance the OID counters.
PITR does not reset the OID counters and thus is not affected by this bug. It does not call `DoImportSnapshotMeta` and thus is not affected by this change.
Reviewers: xCluster, mhaddad
Reviewed By: mhaddad
Subscribers: ybase
Differential Revision: https://phorge.dev.yugabyte.com/D45322