-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrevert tier storage.xml
More file actions
135 lines (96 loc) · 4.67 KB
/
revert tier storage.xml
File metadata and controls
135 lines (96 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<export><workspace name="Workspace 2"><query name="7. fast locking" focus="true" listorder="1" taborder="2" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
const admin = require('/MarkLogic/admin.xqy');
let config = admin.getConfiguration()
config = admin.databaseSetLocking(config, xdmp.database("data-hub-FINAL"),
"fast")
admin.saveConfiguration(config)
//returns the new configuration element -- use admin.saveConfiguration
//to save the changes to the configuration or pass the configuration
//to other Admin API functions to make other changes. </query><query name="3 - delete partition" focus="false" listorder="2" taborder="1" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
const ts = require('/MarkLogic/tieredstorage');
declareUpdate();
ts.partitionDelete(
xdmp.database('data-hub-FINAL'),
'tier1',
false
)
ts.partitionDelete(
xdmp.database('data-hub-FINAL'),
'hot',
false
)</query><query name="2- detachForest" focus="false" listorder="3" taborder="3" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
const admin = require('/MarkLogic/admin.xqy');
let config = admin.getConfiguration()
let nbOfForests = 3
let prefix = "tier1-000"
for (let index = 1; index <= nbOfForests; ++index) {
const forestid = admin.forestGetId(config, prefix+index)
config = admin.databaseDetachForest(config, xdmp.database("data-hub-FINAL"), forestid)
}
admin.saveConfiguration(config)
nbOfForests = 3
prefix = "hot-000"
for (let index = 1; index <= nbOfForests; ++index) {
const forestid = admin.forestGetId(config, prefix+index)
config = admin.databaseDetachForest(config, xdmp.database("data-hub-FINAL"), forestid)
}
admin.saveConfiguration(config)</query><query name="4 - rename forests" focus="false" listorder="4" taborder="4" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
const admin = require('/MarkLogic/admin.xqy');
let nbOfForests = 3
let forestPrefix = "Datahub-FINAL-"
let newPrefix = "data-hub-FINAL-"
let errors = []
let config = null
for (let index = 1; index <= nbOfForests; ++index) {
try{
let forestId = admin.forestGetId(
admin.getConfiguration(),
forestPrefix + index
)
config = admin.forestRename(admin.getConfiguration(), forestId, fn.replace(forestPrefix + index, forestPrefix, newPrefix))
admin.saveConfiguration(config)
} catch (error) {
errors.push(error)
}
}
errors
</query><query name="1 - set false query to rebalance data" focus="false" listorder="5" taborder="5" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
// Sets the query for partition 2 in the Schemas database so that
// the documents will go to partition 1
const ts = require('/MarkLogic/tieredstorage');
declareUpdate();
ts.partitionSetQuery(
xdmp.schemaDatabase(xdmp.database('data-hub-FINAL')),
2,
cts.falseQuery());
</query><query name="5 - Forest delete" focus="false" listorder="6" taborder="6" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
'use strict';
const admin = require('/MarkLogic/admin.xqy');
let nbOfForests = 3
let forestPrefix = "tier1-000"
let errors = []
let config = null
for (let index = 1; index <= nbOfForests; ++index) {
try{
let forestId = admin.forestGetId(
admin.getConfiguration(),
forestPrefix + index
)
config = admin.forestDelete(admin.getConfiguration(),forestId, true)
admin.saveConfiguration(config)
} catch (error) {
errors.push(error)
}
}
errors
</query><query name="6 - attach forest" focus="false" listorder="7" taborder="7" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
const admin = require('/MarkLogic/admin.xqy');
let config = admin.getConfiguration()
let nbOfForests = 3
let prefix = "data-hub-FINAL-"
for (let index = 1; index <= nbOfForests; ++index) {
const forestid = admin.forestGetId(config, prefix+index)
config = admin.databaseAttachForest(config, xdmp.database("data-hub-FINAL"), forestid)
}
admin.saveConfiguration(config)
</query></workspace></export>