-
Notifications
You must be signed in to change notification settings - Fork 0
/
tierStorageWorkspace.xml
130 lines (98 loc) · 5.49 KB
/
tierStorageWorkspace.xml
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
<export><workspace name="Workspace 1"><query name="3 default partition" focus="false" listorder="1" 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.queryPartitionCreate(
xdmp.database('data-hub-FINAL'),
'hot',
1,
0,
xdmp.host('3debf10f4b5d')
);
/*tieredstorage.queryPartitionCreate(
$database-id as (Number|String),
$partition-name as String,
$partition-number as Number?,
$forests-per-host as Number,
$host-ids as (Number|String)[],
[$data-directory as String?],
[$large-data-directory as String?],
[$fast-data-directory as String?],
[$options as String[]]
) as null*/</query><query name="2 query assignment" focus="false" listorder="2" 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');
const config = admin.getConfiguration();
const dbId = admin.databaseGetId(config, 'data-hub-FINAL');
const policy = admin.queryAssignmentPolicy(1);
let newConfig = admin.databaseSetAssignmentPolicy(config, dbId, policy);
admin.saveConfiguration(newConfig)
// 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="4 rename forests" focus="false" listorder="3" 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 = "hot-000"
let errors = []
for (let index = 1; index <= nbOfForests; ++index) {
try{
let forestId = admin.forestGetId(
admin.getConfiguration(),
forestPrefix + index
)
let config = admin.forestRename(admin.getConfiguration(), forestId, fn.replace(forestPrefix + index, forestPrefix, newPrefix))
admin.saveConfiguration(config)
} catch (error) {
errors.push(error)
}
}
errors
</query><query name="5 set forests to partition" focus="false" listorder="4" taborder="6" 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 = "hot-000"
let errors = []
for (let index = 1; index <= nbOfForests; ++index) {
const forestid = admin.forestGetId(config, prefix+index)
config = admin.forestSetPartitionNumber(config, forestid, 1)
}
admin.saveConfiguration(config)
</query><query name="6 create tier1 partition" focus="false" listorder="5" taborder="3" 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.queryPartitionCreate(
xdmp.database('data-hub-FINAL'),
'tier1',
2,
0,
xdmp.host('3debf10f4b5d'),
"/var/opt/MarkLogic/partition2"
);
</query><query name="7 set query partition" focus="true" listorder="6" taborder="8" 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 1 in the Schemas database so that
// the documents with a LastModified date within last year will
// go to partition 1. Other documents will go to partition 2.
const ts = require('/MarkLogic/tieredstorage');
declareUpdate();
ts.partitionSetQuery(
xdmp.schemaDatabase(xdmp.database('data-hub-FINAL')),
2,
cts.notQuery(cts.collectionQuery("latest")));
</query><query name="1. strict locking" 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()
config = admin.databaseSetLocking(config, xdmp.database("data-hub-FINAL"),
"strict")
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="test create document" focus="false" listorder="8" taborder="5" active="true" database="9810354460708727325" server="703141971511690025" database-name="data-hub-FINAL" server-name="data-hub-FINAL" mode="javascript">'use strict';
declareUpdate()
let doc = cts.doc("/entity/contrat/10RC0003886417.json").toObject()
doc.envelope.instance.Contrat.CdNatCtr="test2"
temporal.documentInsert("uni-temporal", "/entity/contrat/10RC0003886417.json", doc)
</query><query name="set partition offline" focus="false" listorder="9" taborder="7" 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.partitionSetAvailability(xdmp.database('data-hub-FINAL'), 'tier1', 'offline');
</query></workspace></export>