[SERVER-25979] View graph invalid on WriteUnitOfWork rollback Created: 06/Sep/16  Updated: 19/Nov/16  Resolved: 08/Sep/16

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.3.14

Type: Bug Priority: Major - P3
Reporter: James Wahlin Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: read-only-views
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-25808 Test concurrent view modification for... Closed
is related to SERVER-26023 Create unit tests for view_catalog.h/... Closed
Backwards Compatibility: Major Change
Operating System: ALL
Steps To Reproduce:

Reproducible via WIP fsm test for views cycle detection (SERVER-25808):

'use strict';
 
/**
 * view_catalog_cycle_with_drop.js
 *
 *
 */
 
load('jstests/concurrency/fsm_workload_helpers/drop_utils.js');  // for dropCollections
 
var $config = (function() {
 
    var data = {
        // Use the workload name as a prefix for the view names,
        // since the workload name is assumed to be unique.
        prefix: 'view_catalog_cycle_with_drop',
        viewList: ["viewA", "viewB", "viewC"],
    };
 
    function assertIfNotOKAndNotCode(result, code) {
        assertAlways(result.ok === 1 || (result.ok === 0 && result.code !== code, tojson(result)));
    }
 
    var states = (function() {
        function init(db, colName) {
        }
 
        function remapViewToView(db, colName) {
            let fromName = this.viewList[Random.randInt(3)];
            let toName = this.viewList[Random.randInt(3)];
            let res = db.runCommand({collMod: fromName, viewOn: toName, pipeline: []});
            assertIfNotOKAndNotCode(res, ErrorCodes.GraphContainsCycle);
        }
 
        function readFromView(db, colName) {
            let viewName = this.viewList[Random.randInt(3)];
            assert.commandWorked(db.runCommand({find: viewName}),
                                 viewName + ": " + tojson(db.runCommand({listCollections: 1})));
        }
 
        return {
            init: init,
            remapViewToView: remapViewToView,
            readFromView: readFromView
        };
 
    })();
 
    var transitions = {
        init: {remapViewToView: .75, readFromView: .25},
        remapViewToView: {remapViewToView: .75, readFromView: .25},
        readFromView: {remapViewToView: .50, readFromView: .50},
    };
 
 
    function setup(db, collName, cluster) {
        // Setup base collection & populate.
        let col = db[collName];
 
        assertAlways.writeOK(col.insert({x: 1}));
 
        for (var i in this.viewList) {
            db.createView(this.viewList[i], collName, []);
        }
 
        jsTest.log(tojson(db.runCommand({listCollections: 1})));
    };
 
    function teardown(db, collName, cluster) {
        var pattern = new RegExp('^' + this.prefix + '_\\d+$');
        dropCollections(db, pattern);
    };
 
    return {
        threadCount: 100,
        iterations: 100,
        data: data,
        states: states,
        transitions: transitions,
        setup: setup,
        teardown: teardown,
    };
 
})();

Participants:

 Description   

ViewCatalog::_upsertIntoGraph sets _viewGraphNeedsRefresh to false on successful insert, but does not take into account post-insert rollback. This can lead to successful creation of view definition cycles.

_viewGraphNeedsRefresh should be set back to true on rollback.



 Comments   
Comment by Githook User [ 08/Sep/16 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-25979 View graph invalid on WUOW rollback
Branch: master
https://github.com/mongodb/mongo/commit/02cf794bf0e942b2c1dd12d59fc9b3cf45e62f91

Generated at Thu Feb 08 04:10:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.