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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@SuppressFBWarnings(value="MS_PKGPROTECT")
public abstract class BaseDataDictionary implements DataDictionary, ModuleControl, ModuleSupportable,java.security.PrivilegedAction {
protected static final String CFG_SYSTABLES_ID = "SystablesIdentifier";
protected static final String CFG_SYSTABLES_INDEX1_ID = "SystablesIndex1Identifier";
public static final String CFG_SYSTABLES_INDEX1_ID = "SystablesIndex1Identifier";
protected static final String CFG_SYSTABLES_INDEX2_ID = "SystablesIndex2Identifier";
protected static final String CFG_SYSCOLUMNS_ID = "SyscolumnsIdentifier";
protected static final String CFG_SYSCOLUMNS_INDEX1_ID = "SyscolumnsIndex1Identifier";
Expand All @@ -61,7 +61,7 @@ public abstract class BaseDataDictionary implements DataDictionary, ModuleContro
protected static final String CFG_SYSDATABASES_INDEX2_ID = "SysdatabasesIndex2Identifier";
public static final String CFG_ALLOW_MULTIDATABASE = "AllowMultidatabase";
protected static final int SYSCONGLOMERATES_CORE_NUM = 0;
protected static final int SYSTABLES_CORE_NUM = 1;
public static final int SYSTABLES_CORE_NUM = 1;
protected static final int SYSCOLUMNS_CORE_NUM = 2;
protected static final int SYSSCHEMAS_CORE_NUM = 3;
protected static final int SYSDATABASES_CORE_NUM = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1873,4 +1873,12 @@ private void insertIndex(TransactionController tc,
cd.getDescriptorName(), tabInfo.getTableName());
}
}

public void updateBootstrapProperty(Properties startParams, int catalogNum, String indexName, int indexId) {
if (catalogNum > NUM_CORE)
return;

startParams.put(indexName,Long.toString(
coreInfo[catalogNum].getIndexConglomerate(indexId)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd, TransactionControll

scripts = new ArrayList<>();
addUpgradeScript(baseVersion4, 2020, new UpgradeAddConglomerateNumberIndex(sdd, tc));
addUpgradeScript(baseVersion4, 2024, new UpgradeScriptToPrioritizeSchemaIdInSystemIndices(sdd, tc));
addUpgradeScript(baseVersion4, 2024, new UpgradeScriptToPrioritizeSchemaIdInSystemIndices(sdd, tc, startParams));
// DB-11296: UpgradeConglomerateTable has to be executed first, because it adds a system table
Copy link
Contributor

@ipraznik-splice ipraznik-splice Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my question is if should the version be changed to 2025 in this case? The migration was done for the previous build 2024, but fixed in 2025.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should still be 2024 in theory, because the index were changed since 2024, but we should recommend customer install 2025 build to trigger upgrade.

// CONGLOMERATE_SI_TABLE_NAME that is from then on needed to create tables, e.g.
// in UpgradeScriptToAddSysNaturalNumbersTable. If UpgradeConglomerateTable is at the end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@
import com.splicemachine.db.iapi.store.access.TransactionController;
import com.splicemachine.db.impl.sql.catalog.*;
import com.splicemachine.derby.impl.sql.catalog.SpliceDataDictionary;
import com.splicemachine.utils.SpliceLogUtils;

import java.util.Properties;

import static com.splicemachine.db.impl.sql.catalog.BaseDataDictionary.CFG_SYSTABLES_INDEX1_ID;

public class UpgradeScriptToPrioritizeSchemaIdInSystemIndices extends UpgradeScriptBase {
public UpgradeScriptToPrioritizeSchemaIdInSystemIndices(SpliceDataDictionary sdd, TransactionController tc) {

private Properties startParams;

public UpgradeScriptToPrioritizeSchemaIdInSystemIndices(SpliceDataDictionary sdd,
TransactionController tc,
Properties startParams) {
super(sdd, tc);
this.startParams = startParams;
}

@Override
Expand All @@ -35,6 +42,9 @@ protected void upgradeSystemTables() throws StandardException {
new int[]{SYSTABLESRowFactory.SYSTABLES_INDEX1_ID}
);

sdd.updateBootstrapProperty(startParams, BaseDataDictionary.SYSTABLES_CORE_NUM,
CFG_SYSTABLES_INDEX1_ID, SYSTABLESRowFactory.SYSTABLES_INDEX1_ID);

sdd.upgradeRecreateIndexesOfSystemTable(
tc,
DataDictionary.SYSTRIGGERS_CATALOG_NUM,
Expand Down