feat: add indexes for index_block_hash on BNS tables (#1304)

* feat: add bns indexes for index_block_hash

* fix: go back to default log level before importing subdomains
This commit is contained in:
Rafael Cárdenas
2022-09-01 08:21:02 -05:00
committed by GitHub
parent 040eb7e8c2
commit bbf4b2d2b8
4 changed files with 5 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ import * as path from 'path';
import * as fs from 'fs';
import { cycleMigrations, dangerousDropAllTables, PgDataStore } from '../datastore/postgres-store';
import { startEventServer } from '../event-stream/event-server';
import { getApiConfiguredChainID, httpPostRequest, logger } from '../helpers';
import { defaultLogLevel, getApiConfiguredChainID, httpPostRequest, logger } from '../helpers';
import { findBnsGenesisBlockData, findTsvBlockHeight, getDbBlockHeight } from './helpers';
import { importV1BnsNames, importV1BnsSubdomains, importV1TokenOfferingData } from '../import-v1';
@@ -179,6 +179,7 @@ export async function importEventsFromTsv(
}
await db.finishEventReplay();
if (process.env.BNS_IMPORT_DIR) {
logger.level = defaultLogLevel;
await importV1BnsSubdomains(db, process.env.BNS_IMPORT_DIR, tsvGenesisBlockData);
}
console.log(`Event import and playback successful.`);

View File

@@ -91,6 +91,7 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
},
});
pgm.createIndex('namespaces', 'index_block_hash');
pgm.createIndex('namespaces', [
{ name: 'ready_block', sort: 'DESC' },
{ name: 'microblock_sequence', sort: 'DESC' },

View File

@@ -84,6 +84,7 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
});
pgm.createIndex('names', 'namespace_id');
pgm.createIndex('names', 'index_block_hash');
pgm.createIndex('names', [
{ name: 'registered_at', sort: 'DESC' },
{ name: 'microblock_sequence', sort: 'DESC' },

View File

@@ -85,6 +85,7 @@ export async function up(pgm: MigrationBuilder): Promise<void> {
});
pgm.createIndex('subdomains', 'name');
pgm.createIndex('subdomains', 'index_block_hash');
pgm.createIndex('subdomains', [
{ name: 'block_height', sort: 'DESC' },
{ name: 'microblock_sequence', sort: 'DESC' },