Skip to content
Draft
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
13 changes: 11 additions & 2 deletions bin/copyDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
const sourceDbisDb = rootStore.dbisDb;
const sourceAuditStore = rootStore.auditStore;
const targetEnv = open(new OpenEnvironmentObject(targetDatabasePath));
const targetDbisDb = targetEnv.openDB(INTERNAL_DBIS_NAME);

Check failure on line 164 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v24)

Argument of type 'string' is not assignable to parameter of type 'DatabaseOptions & { name: string; }'.

Check failure on line 164 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v22)

Argument of type 'string' is not assignable to parameter of type 'DatabaseOptions & { name: string; }'.

Check failure on line 164 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v20)

Argument of type 'string' is not assignable to parameter of type 'DatabaseOptions & { name: string; }'.

Check failure on line 164 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v20)

Argument of type 'string' is not assignable to parameter of type 'DatabaseOptions & { name: string; }'.

Check failure on line 164 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v24)

Argument of type 'string' is not assignable to parameter of type 'DatabaseOptions & { name: string; }'.

Check failure on line 164 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v22)

Argument of type 'string' is not assignable to parameter of type 'DatabaseOptions & { name: string; }'.
let written;
let outstandingWrites = 0;
// we use a single transaction to get a snapshot, also we can't use snapshot: false on dupsort dbs
Expand All @@ -187,22 +187,31 @@
// we want to directly copy bytes so we don't have the overhead of
// encoding and decoding
dbiInit.encoding = 'binary';
dbiInit.compression = existingCompression;

Check failure on line 190 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v24)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 190 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v22)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 190 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v20)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 190 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v20)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 190 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v24)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 190 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v22)

Property 'compression' does not exist on type 'OpenDBIObject'.
//dbiInit.keyEncoding = 'binary';
const sourceDbi = rootStore.openDB(key, dbiInit);
sourceDbi.decoder = null;
sourceDbi.decoderCopies = false;
sourceDbi.encoding = 'binary';
dbiInit.compression = newCompression;

Check failure on line 196 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v24)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 196 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v22)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 196 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v20)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 196 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v20)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 196 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v24)

Property 'compression' does not exist on type 'OpenDBIObject'.

Check failure on line 196 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v22)

Property 'compression' does not exist on type 'OpenDBIObject'.
const targetDbi = targetEnv.openDB(key, dbiInit);

Check failure on line 197 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v24)

Argument of type 'OpenDBIObject' is not assignable to parameter of type 'DatabaseOptions'.

Check failure on line 197 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v22)

Argument of type 'OpenDBIObject' is not assignable to parameter of type 'DatabaseOptions'.

Check failure on line 197 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v20)

Argument of type 'OpenDBIObject' is not assignable to parameter of type 'DatabaseOptions'.

Check failure on line 197 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v20)

Argument of type 'OpenDBIObject' is not assignable to parameter of type 'DatabaseOptions'.

Check failure on line 197 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v24)

Argument of type 'OpenDBIObject' is not assignable to parameter of type 'DatabaseOptions'.

Check failure on line 197 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v22)

Argument of type 'OpenDBIObject' is not assignable to parameter of type 'DatabaseOptions'.
targetDbi.encoder = null;

Check failure on line 198 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v24)

Property 'encoder' does not exist on type 'Database<any, Key>'.

Check failure on line 198 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v22)

Property 'encoder' does not exist on type 'Database<any, Key>'.

Check failure on line 198 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v20)

Property 'encoder' does not exist on type 'Database<any, Key>'.

Check failure on line 198 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v20)

Property 'encoder' does not exist on type 'Database<any, Key>'.

Check failure on line 198 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v24)

Property 'encoder' does not exist on type 'Database<any, Key>'.

Check failure on line 198 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v22)

Property 'encoder' does not exist on type 'Database<any, Key>'.
console.log('copying', key, 'from', sourceDatabase, 'to', targetDatabasePath);
await copyDbi(sourceDbi, targetDbi, isPrimary, transaction);
}
if (sourceAuditStore) {
const targetAuditStore = rootStore.openDB(AUDIT_STORE_NAME, AUDIT_STORE_OPTIONS);
// Copy audit store in binary mode to avoid encode/decode issues with symbol-keyed metadata entries
const auditBinaryOptions: any = {
keyEncoder: AUDIT_STORE_OPTIONS.keyEncoder,
encoding: 'binary',
};
const sourceAuditBinary: any = rootStore.openDB(AUDIT_STORE_NAME, auditBinaryOptions);
sourceAuditBinary.decoder = null;
sourceAuditBinary.decoderCopies = false;
const targetAuditStore: any = targetEnv.openDB(AUDIT_STORE_NAME, auditBinaryOptions);
targetAuditStore.encoder = null;
console.log('copying audit log for', sourceDatabase, 'to', targetDatabasePath);
copyDbi(sourceAuditStore, targetAuditStore, false, transaction);
await copyDbi(sourceAuditBinary, targetAuditStore, false, transaction);
}

async function copyDbi(sourceDbi, targetDbi, isPrimary, transaction) {
Expand Down Expand Up @@ -289,7 +298,7 @@
}
let db;
if (options.dupSort) {
db = RocksDatabase.open(new RocksIndexStore(path, options));

Check failure on line 301 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v24)

Argument of type 'RocksIndexStore' is not assignable to parameter of type 'string | Store'.

Check failure on line 301 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v22)

Argument of type 'RocksIndexStore' is not assignable to parameter of type 'string | Store'.

Check failure on line 301 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Build Harper (Node.js v20)

Argument of type 'RocksIndexStore' is not assignable to parameter of type 'string | Store'.

Check failure on line 301 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v20)

Argument of type 'RocksIndexStore' is not assignable to parameter of type 'string | Store'.

Check failure on line 301 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v24)

Argument of type 'RocksIndexStore' is not assignable to parameter of type 'string | Store'.

Check failure on line 301 in bin/copyDb.ts

View workflow job for this annotation

GitHub Actions / Unit Test (Node.js v22)

Argument of type 'RocksIndexStore' is not assignable to parameter of type 'string | Store'.
} else {
db = RocksDatabase.open(path, options);
db.encoder.name = options.name;
Expand Down
Loading