Skip to content

Commit d6e5c23

Browse files
authored
Merge pull request #563 from M4xymm/RDBC-1081-2
RDBC-1081 Add TimeSeriesDeletedRanges, MaxReadOpsPerSecond and SkipCorruptedData to smuggler options
2 parents c45216c + 354c9a5 commit d6e5c23

4 files changed

Lines changed: 45 additions & 2 deletions

File tree

src/Documents/Smuggler/DatabaseItemType.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ export type DatabaseItemType =
1717
| "Subscriptions"
1818
| "CompareExchangeTombstones"
1919
| "TimeSeries"
20-
| "ReplicationHubCertificates";
20+
| "ReplicationHubCertificates"
21+
| "TimeSeriesDeletedRanges";

src/Documents/Smuggler/DatabaseSmugglerOptions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DatabaseRecordItemType } from "./DatabaseRecordItemType.js";
55
export class DatabaseSmugglerOptions implements IDatabaseSmugglerOptions {
66
public static readonly DEFAULT_OPERATE_ON_TYPES: DatabaseItemType[] = [
77
"Indexes", "Documents", "RevisionDocuments", "Conflicts", "DatabaseRecord", "ReplicationHubCertificates", "Identities",
8-
"CompareExchange", "Attachments", "CounterGroups", "Subscriptions", "TimeSeries"
8+
"CompareExchange", "Attachments", "CounterGroups", "Subscriptions", "TimeSeries", "TimeSeriesDeletedRanges"
99
];
1010

1111
public static readonly DEFAULT_OPERATE_ON_DATABASE_RECORD_TYPES: DatabaseRecordItemType[] = [
@@ -31,6 +31,7 @@ export class DatabaseSmugglerOptions implements IDatabaseSmugglerOptions {
3131

3232
public encryptionKey: string;
3333
public collections: string[];
34+
public maxReadOpsPerSecond?: number;
3435
/**
3536
* In case the database is corrupted (for example, Compression Dictionaries are lost), it is possible to export all the remaining data.
3637
*/

src/Documents/Smuggler/IDatabaseSmugglerOptions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ export interface IDatabaseSmugglerOptions {
1212
skipRevisionCreation: boolean;
1313
collections: string[];
1414
operateOnDatabaseRecordType: DatabaseRecordItemType[];
15+
maxReadOpsPerSecond?: number;
16+
skipCorruptedData?: boolean;
1517
}

test/Ported/SmugglerTest.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,45 @@ describe("SmugglerTest", function () {
7979
}
8080
});
8181

82+
it("can export and import with maxReadOpsPerSecond, skipCorruptedData and timeSeriesDeletedRanges", async () => {
83+
const exportFile = path.join(temporaryDirContext.tempDir, "exported-db-3." + CONSTANTS.Documents.PeriodicBackup.FULL_BACKUP_EXTENSION);
84+
85+
const sourceStore = await testContext.getDocumentStore();
86+
87+
try {
88+
await addUsers(sourceStore);
89+
90+
const options = new DatabaseSmugglerExportOptions();
91+
options.maxReadOpsPerSecond = 1000;
92+
options.skipCorruptedData = true;
93+
94+
assertThat(options.operateOnTypes)
95+
.contains("TimeSeriesDeletedRanges");
96+
97+
const operation = await sourceStore.smuggler.export(options, exportFile);
98+
await operation.waitForCompletion();
99+
} finally {
100+
sourceStore.dispose();
101+
}
102+
103+
const dstStore = await testContext.getDocumentStore();
104+
105+
try {
106+
const options = new DatabaseSmugglerImportOptions();
107+
options.maxReadOpsPerSecond = 1000;
108+
options.skipCorruptedData = true;
109+
110+
const operation = await dstStore.smuggler.import(options, exportFile);
111+
await operation.waitForCompletion();
112+
113+
const stats = await dstStore.maintenance.send(new GetStatisticsOperation());
114+
assertThat(stats.countOfDocuments)
115+
.isEqualTo(3);
116+
} finally {
117+
dstStore.dispose();
118+
}
119+
});
120+
82121
it("can sort files", () => {
83122
const files = [
84123
"2018-11-08-10-47.ravendb-incremental-backup",

0 commit comments

Comments
 (0)