Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed sections.offsets table #1081

Merged
merged 3 commits into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions projects/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/mobileapps:
x-modules:
- path: sys/mobileapps.js
Expand Down
2 changes: 0 additions & 2 deletions projects/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,5 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
options: '{{options}}'

2 changes: 0 additions & 2 deletions projects/wmf_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/key_value: &sys_key_value
x-modules:
- path: sys/key_value.js
Expand Down
2 changes: 0 additions & 2 deletions projects/wmf_enwiki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/key_value: &sys_key_value
x-modules:
- path: sys/key_value.js
Expand Down
2 changes: 0 additions & 2 deletions projects/wmf_wikidata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/key_value: &sys_key_value
x-modules:
- path: sys/key_value.js
Expand Down
2 changes: 0 additions & 2 deletions projects/wmf_wikipedia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/key_value: &sys_key_value
x-modules:
- path: sys/key_value.js
Expand Down
2 changes: 0 additions & 2 deletions projects/wmf_wikivoyage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/key_value: &sys_key_value
x-modules:
- path: sys/key_value.js
Expand Down
2 changes: 0 additions & 2 deletions projects/wmf_wiktionary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ paths:
dependent_content_types:
- name: data-parsoid
value_type: json
- name: section-offsets
value_type: json
/key_value: &sys_key_value
x-modules:
- path: sys/key_value.js
Expand Down
43 changes: 9 additions & 34 deletions sys/parsoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,33 +257,18 @@ class ParsoidService {
uri: this.getNGBucketURI(rp, 'all', tid),
body: {
html: parsoidResp.body.html,
'data-parsoid': parsoidResp.body['data-parsoid'],
'section-offsets': {
headers: {
'content-type': 'application/json'
},
body: parsoidResp.body['data-parsoid'].body.sectionOffsets
}
'data-parsoid': parsoidResp.body['data-parsoid']
}
});
}

saveParsoidResultToFallback(hyper, req, tid, parsoidResp) {
const rp = req.params;
return P.all([
hyper.put({
uri: this.getFallbackBucketURI(rp, 'data-parsoid', tid),
headers: parsoidResp.body['data-parsoid'].headers,
body: parsoidResp.body['data-parsoid'].body
}),
hyper.put({
uri: this.getFallbackBucketURI(rp, 'section-offsets', tid),
headers: {
'content-type': 'application/json'
},
body: parsoidResp.body['data-parsoid'].body.sectionOffsets
}),
])
return hyper.put({
uri: this.getFallbackBucketURI(rp, 'data-parsoid', tid),
headers: parsoidResp.body['data-parsoid'].headers,
body: parsoidResp.body['data-parsoid'].body
})
.then(() => hyper.put({
uri: this.getFallbackBucketURI(rp, 'html', tid),
headers: parsoidResp.body.html.headers,
Expand Down Expand Up @@ -408,11 +393,11 @@ class ParsoidService {
tid: etagInfo.tid
});
return this._getContentWithFallback(hyper, sectionsRP,
'section-offsets', sectionsRP.tid)
.then(sectionOffsets => mwUtil.decodeBody(htmlRes).then((content) => {
'data-parsoid', sectionsRP.tid)
.then(dataParsoid => mwUtil.decodeBody(htmlRes).then((content) => {
const body = cheapBodyInnerHTML(content.body);
const chunks = sections.reduce((result, id) => {
const offsets = sectionOffsets.body[id];
const offsets = dataParsoid.body.sectionOffsets[id];
if (!offsets) {
throw new HTTPError({
status: 400,
Expand Down Expand Up @@ -908,16 +893,6 @@ module.exports = (options) => {
default_time_to_live: options.grace_ttl
}
},
{
// TODO: the `-ng` is only here because we have just one cass cluster
// in dev. Remove before deploying to production
uri: '/{domain}/sys/key_rev_value/parsoid.stash.section-offsets-ng',
body: {
valueType: 'json',
version: 3,
default_time_to_live: options.grace_ttl
}
},
{
uri: '/{domain}/sys/parsoid_bucket/'
}
Expand Down