/*! \fn QString QOperatingSystemVersion::name() const Returns a string representation of the OS type identified by the QOperatingSystemVersion. \sa type() */ QString QOperatingSystemVersion::name() const { switch (type()) { case QOperatingSystemVersion::Windows: return QStringLiteral("Windows"); case QOperatingSystemVersion::MacOS: { if (majorVersion() < 10) return QStringLiteral("Mac OS"); if (majorVersion() == 10 && minorVersion() < 8) return QStringLiteral("Mac OS X"); if (majorVersion() == 10 && minorVersion() < 12) return QStringLiteral("OS X"); return QStringLiteral("macOS"); } case QOperatingSystemVersion::IOS: { if (majorVersion() < 4) return QStringLiteral("iPhone OS"); return QStringLiteral("iOS"); } case QOperatingSystemVersion::TvOS: return QStringLiteral("tvOS"); case QOperatingSystemVersion::WatchOS: return QStringLiteral("watchOS"); case QOperatingSystemVersion::Android: return QStringLiteral("Android"); case QOperatingSystemVersion::Unknown: default: return QString(); } }
QString QgsPostgresConn::fieldExpression( const QgsField &fld ) { const QString &type = fld.typeName(); if ( type == "money" ) { return QString( "cash_out(%1)" ).arg( quotedIdentifier( fld.name() ) ); } else if ( type.startsWith( "_" ) ) { return QString( "array_out(%1)" ).arg( quotedIdentifier( fld.name() ) ); } else if ( type == "bool" ) { return QString( "boolout(%1)" ).arg( quotedIdentifier( fld.name() ) ); } else if ( type == "geometry" ) { return QString( "%1(%2)" ) .arg( majorVersion() < 2 ? "asewkt" : "st_asewkt" ) .arg( quotedIdentifier( fld.name() ) ); } else if ( type == "geography" ) { return QString( "st_astext(%1)" ).arg( quotedIdentifier( fld.name() ) ); } else { return quotedIdentifier( fld.name() ) + "::text"; } }
static QString subsystemVersion(const QString &version) { const auto v = Internal::Version::fromString(version); return QStringLiteral("%1.%2").arg( QString::number(v.majorVersion()), QString::number(v.minorVersion()).rightJustified(2, QLatin1Char('0'))); }
// Write virtual function overries used to decide on static/virtual calls int QHttpRequestHeader_QtDShell::__override_majorVersion(bool static_call) const { if (static_call) { return QHttpRequestHeader::majorVersion(); } else { return majorVersion(); } }
const std::string &versionString() { static std::string v; if( !v.size() ) { v = boost::str( boost::format( "%d.%d.%d" ) % majorVersion() % minorVersion() % patchVersion() ); } return v; }
bool VersionInfoInterface::isSameMajorVersion(const char* otherVersion) const noexcept { int major = -1, minor = -1; pcrecpp::RE ver_regex("^(\\d+)\\.(\\d+)\\."); ver_regex.PartialMatch(otherVersion, &major, &minor); if (major == -1 || minor == -1) return false; return (major == majorVersion() && minor == minorVersion()); }
bool Version::candidateGreaterThanCurrent(const VersionThing & candidateVersionThing) { VersionThing myVersionThing; myVersionThing.majorVersion = majorVersion().toInt(); myVersionThing.minorVersion = minorVersion().toInt(); myVersionThing.minorSubVersion = minorSubVersion().toInt(); myVersionThing.releaseModifier = modifier(); return greaterThan(myVersionThing, candidateVersionThing); }
/*! Returns a byte array representation of the HTTP request header. */ QByteArray THttpRequestHeader::toByteArray() const { QByteArray ba; ba += reqMethod + ' ' + reqUri + " HTTP/"; ba += QByteArray::number(majorVersion()); ba += '.'; ba += QByteArray::number(minorVersion()); ba += "\r\n"; ba += THttpHeader::toByteArray(); return ba; }
Status onShardVersionMismatch(OperationContext* opCtx, const NamespaceString& nss, ChunkVersion shardVersionReceived, bool forceRefreshFromThisThread) noexcept { invariant(!opCtx->lockState()->isLocked()); invariant(!opCtx->getClient()->isInDirectClient()); auto const shardingState = ShardingState::get(opCtx); invariant(shardingState->canAcceptShardedCommands()); LOG(2) << "Metadata refresh requested for " << nss.ns() << " at shard version " << shardVersionReceived; ShardingStatistics::get(opCtx).countStaleConfigErrors.addAndFetch(1); // Ensure any ongoing migrations have completed before trying to do the refresh. This wait is // just an optimization so that MongoS does not exhaust its maximum number of StaleConfig retry // attempts while the migration is being committed. try { auto& oss = OperationShardingState::get(opCtx); oss.waitForMigrationCriticalSectionSignal(opCtx); } catch (const DBException& ex) { return ex.toStatus(); } const auto currentShardVersion = [&] { AutoGetCollection autoColl(opCtx, nss, MODE_IS); const auto currentMetadata = CollectionShardingState::get(opCtx, nss)->getMetadata(opCtx); if (currentMetadata) { return currentMetadata->getShardVersion(); } return ChunkVersion::UNSHARDED(); }(); if (currentShardVersion.epoch() == shardVersionReceived.epoch() && currentShardVersion.majorVersion() >= shardVersionReceived.majorVersion()) { // Don't need to remotely reload if we're in the same epoch and the requested version is // smaller than the one we know about. This means that the remote side is behind. return Status::OK(); } try { forceShardFilteringMetadataRefresh(opCtx, nss, forceRefreshFromThisThread); return Status::OK(); } catch (const DBException& ex) { log() << "Failed to refresh metadata for collection" << nss << causedBy(redact(ex)); return ex.toStatus(); } }
/*! Returns a byte array representation of the HTTP response header. */ QByteArray THttpResponseHeader::toByteArray() const { QByteArray ba; ba += "HTTP/"; ba += QByteArray::number(majorVersion()); ba += '.'; ba += QByteArray::number(minorVersion()); ba += ' '; ba += QByteArray::number(statCode); ba += ' '; ba += reasonPhr; ba += "\r\n"; ba += THttpHeader::toByteArray(); return ba; }
void VersionInfoInterface::appendBuildInfo(BSONObjBuilder* result) const { *result << "version" << version() << "gitVersion" << gitVersion() #if defined(_WIN32) << "targetMinOS" << targetMinOS() #endif << "modules" << modules() << "allocator" << allocator() << "javascriptEngine" << jsEngine() << "sysInfo" << "deprecated"; BSONArrayBuilder versionArray(result->subarrayStart("versionArray")); versionArray << majorVersion() << minorVersion() << patchVersion() << extraVersion(); versionArray.done(); BSONObjBuilder opensslInfo(result->subobjStart("openssl")); #ifdef MONGO_CONFIG_SSL #if MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_OPENSSL opensslInfo << "running" << openSSLVersion() << "compiled" << OPENSSL_VERSION_TEXT; #elif MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_WINDOWS opensslInfo << "running" << "Windows SChannel"; #elif MONGO_CONFIG_SSL_PROVIDER == MONGO_CONFIG_SSL_PROVIDER_APPLE opensslInfo << "running" << "Apple Secure Transport"; #else #error "Unknown SSL Provider" #endif // MONGO_CONFIG_SSL_PROVIDER #else opensslInfo << "running" << "disabled" << "compiled" << "disabled"; #endif opensslInfo.done(); BSONObjBuilder buildvarsInfo(result->subobjStart("buildEnvironment")); for (auto&& envDataEntry : buildInfo()) { if (std::get<2>(envDataEntry)) { buildvarsInfo << std::get<0>(envDataEntry) << std::get<1>(envDataEntry); } } buildvarsInfo.done(); *result << "bits" << (int)sizeof(void*) * 8; result->appendBool("debug", kDebugBuild); result->appendNumber("maxBsonObjectSize", BSONObjMaxUserSize); }
//------------------------------------------------------------------------------------------------- bool GlesBox::bindEGLContext(uint32_t width, uint32_t height, uint64_t native_windows_id) { if (core_->display_ == nullptr) { // Get Display core_->display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (core_->display_ == EGL_NO_DISPLAY) { LOGE("Cann't get EGL display on native windows."); return false; } // Initialize EGL EGLint majorVersion(0), minorVersion(0); if (!eglInitialize(core_->display_, &majorVersion, &minorVersion)) { LOGE("Cann't eglInitialize EGL display."); return false; } eglBindAPI(EGL_OPENGL_ES_API); // Get configs EGLint numConfigs(0); if (!eglGetConfigs(core_->display_, NULL, 0, &numConfigs)) { LOGE("eglGetConfigs fail."); return false; } // Choose config EGLint attribList[] = { EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_NONE }; if (!eglChooseConfig(core_->display_, attribList, &core_->config_, 1, &numConfigs)) { LOGE("eglChooseConfig fail."); return false; } createSurface(width, height, native_windows_id); // Create a GL context EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE}; core_->context_ = eglCreateContext(core_->display_, core_->config_, EGL_NO_CONTEXT, contextAttribs); if (core_->context_ == EGL_NO_CONTEXT) { LOGE("eglCreateContext fail."); return false; } } //renew a surface because of size changed if (core_->width_ != width || core_->height_ != height) { createSurface(width, height, native_windows_id); } // Make the context current if ( !eglMakeCurrent(core_->display_, core_->surface_, core_->surface_, core_->context_) ) { LOGE("eglMakeCurrent fail."); return false; } return true; }
Version query::version() { return Version(majorVersion(), minorVersion()); }
void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerProperty, bool useEstimatedMetadata ) { QString table; if ( !layerProperty.schemaName.isEmpty() ) { table = QString( "%1.%2" ) .arg( quotedIdentifier( layerProperty.schemaName ) ) .arg( quotedIdentifier( layerProperty.tableName ) ); } else { // Query table = layerProperty.tableName; } // our estimatation ignores that a where clause might restrict the feature type or srid if ( useEstimatedMetadata ) { table = QString( "(SELECT %1 FROM %2 WHERE %1 IS NOT NULL%3 LIMIT %4) AS t" ) .arg( quotedIdentifier( layerProperty.geometryColName ) ) .arg( table ) .arg( layerProperty.sql.isEmpty() ? "" : QString( " AND (%1)" ).arg( layerProperty.sql ) ) .arg( sGeomTypeSelectLimit ); } else if ( !layerProperty.sql.isEmpty() ) { table += QString( " WHERE %1" ).arg( layerProperty.sql ); } QString query = QString( "SELECT DISTINCT" " CASE" " WHEN %1 THEN 'POINT'" " WHEN %2 THEN 'LINESTRING'" " WHEN %3 THEN 'POLYGON'" " END," " %4(%5%6)" " FROM %7" ) .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBPoint, layerProperty.geometryColType == sctGeography ) ) .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBLineString, layerProperty.geometryColType == sctGeography ) ) .arg( postgisTypeFilter( layerProperty.geometryColName, QGis::WKBPolygon, layerProperty.geometryColType == sctGeography ) ) .arg( majorVersion() < 2 ? "srid" : "st_srid" ) .arg( quotedIdentifier( layerProperty.geometryColName ) ) .arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" ) .arg( table ); QgsDebugMsg( "Retrieving geometry types: " + query ); QgsPostgresResult gresult = PQexec( query ); QString type; QString srid; if ( gresult.PQresultStatus() == PGRES_TUPLES_OK ) { QStringList types; QStringList srids; for ( int i = 0; i < gresult.PQntuples(); i++ ) { QString type = gresult.PQgetvalue( i, 0 ); QString srid = gresult.PQgetvalue( i, 1 ); if ( type.isEmpty() ) continue; types << type; srids << srid; } type = types.join( "," ); srid = srids.join( "," ); } QgsDebugMsg( QString( "type:%1 srid:%2" ).arg( type ).arg( srid ) ); layerProperty.type = type; layerProperty.srid = srid; }
void OpenGLWidget::initializeGL() { // Initialize Qt's OpenGL functions. initializeOpenGLFunctions(); auto format = QOpenGLContext::currentContext()->format(); printf("OpenGL: version %d.%d\n", format.majorVersion(), format.minorVersion()); // General OpenGL settings. glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glCullFace(GL_NONE); // Set color to clear window (black). glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Prepare shader. shader = std::make_unique<QOpenGLShaderProgram>(this); shader->addShaderFromSourceFile(QOpenGLShader::Vertex, QString(SHADER_DIRECTORY) + "render.vert"); shader->addShaderFromSourceFile(QOpenGLShader::Fragment, QString(SHADER_DIRECTORY) + "render.frag"); shader->link(); if (!shader->isLinked()) { std::cerr << "Failed to build shaders!" << std::endl; std::exit(1); } // Load OBJ. const std::string filename = std::string(DATA_DIRECTORY) + "plane.obj"; std::vector<tinyobj::shape_t> shapes; std::vector<tinyobj::material_t> materials; tinyobj::attrib_t attrib; std::string err; bool success = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, filename.c_str()); if (!err.empty()) { std::cerr << err << std::endl; } if (!success) { std::exit(1); } std::vector<Vertex> vertices; std::vector<uint32_t> indices; for (const auto &s : shapes) { for (const auto &index : s.mesh.indices) { const int posIndex = index.vertex_index; QVector3D position; if (posIndex >= 0) { position = { attrib.vertices[posIndex * 3 + 0], attrib.vertices[posIndex * 3 + 1], attrib.vertices[posIndex * 3 + 2] }; } const int normIndex = index.normal_index; QVector3D normal; if (normIndex >= 0) { normal = { attrib.normals[normIndex * 3 + 0], attrib.normals[normIndex * 3 + 1], attrib.normals[normIndex * 3 + 2] }; } const int uvIndex = index.texcoord_index; QVector2D texcoord; if (uvIndex >= 0) { texcoord = { attrib.texcoords[uvIndex * 2 + 0], attrib.texcoords[uvIndex * 2 + 1] }; } indices.push_back(vertices.size()); vertices.emplace_back(position, normal, texcoord); } } // Prepare VAO. vao = std::make_unique<QOpenGLVertexArrayObject>(this); vao->create(); vao->bind(); vbo = std::make_unique<QOpenGLBuffer>(QOpenGLBuffer::VertexBuffer); vbo->create(); vbo->setUsagePattern(QOpenGLBuffer::StaticDraw); vbo->bind(); vbo->allocate(vertices.data(), sizeof(Vertex) * vertices.size()); glEnableVertexAttribArray(POSITION_LAYOUT_LOC); glVertexAttribPointer(POSITION_LAYOUT_LOC, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, position)); glEnableVertexAttribArray(NORMAL_LAYOUT_LOC); glVertexAttribPointer(NORMAL_LAYOUT_LOC, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, normal)); glEnableVertexAttribArray(TEXCOORD_LAYOUT_LOC); glVertexAttribPointer(TEXCOORD_LAYOUT_LOC, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void *)offsetof(Vertex, texcoord)); ibo = std::make_unique<QOpenGLBuffer>(QOpenGLBuffer::IndexBuffer); ibo->create(); ibo->setUsagePattern(QOpenGLBuffer::StaticDraw); ibo->bind(); ibo->allocate(indices.data(), sizeof(uint32_t) * indices.size()); vao->release(); // Prepare texture. const QString imgfile = QString(DATA_DIRECTORY) + "lena.png"; QImage teximage; teximage.load(imgfile); if (teximage.isNull()) { std::cerr << "Failed to load image: " << imgfile.toStdString() << std::endl; } texture = std::make_unique<QOpenGLTexture>(teximage, QOpenGLTexture::GenerateMipMaps); }
Compatibility Reader::open() { if(!_file->isOpen()) { if(!_file->open(QFile::ReadOnly)) { return CANNOT_READ; } } // Read magic bytes "DPRECR\0" or "DPRECH\0" char buf[7]; if(_file->read(buf, 7) != 7) return CANNOT_READ; if(memcmp(buf, "DPRECR", 7)) { if(memcmp(buf, "DPRECH", 7)) return NOT_DPREC; _isHibernation = true; } // Read protocol version if(_file->read(buf, 4) != 4) return NOT_DPREC; _formatversion = qFromBigEndian<quint32>((const uchar*)buf); // Read program version QByteArray progver; do { if(_file->read(buf, 1) != 1) return NOT_DPREC; progver.append(buf[0]); } while(buf[0] != '\0'); _writerversion = QString::fromUtf8(progver); // If this is a hibernation file, read the rest of the header if(_isHibernation) { // We already read the protocol minor version _hibheader.minorVersion = minorVersion(_formatversion); // Check hibernation file format version char fmtver; if(!_file->getChar(&fmtver)) return NOT_DPREC; // Currently there is only one format and no forward compatibility if((uchar)fmtver != 1) return INCOMPATIBLE; // Read session title if(_file->read(buf, 2) != 2) return NOT_DPREC; quint16 titleLen = qFromBigEndian<quint16>((const uchar*)buf); QByteArray title = _file->read(titleLen); if(title.length() != titleLen) return NOT_DPREC; _hibheader.title = QString::fromUtf8(title); // Read session founder name if(_file->read(buf, 1) != 1) return NOT_DPREC; quint8 founderLen = *buf; QByteArray founder = _file->read(founderLen); if(founder.length() != founderLen) return NOT_DPREC; _hibheader.founder = QString::fromUtf8(founder); // Read session flags char flags; if(!_file->getChar(&flags)) return NOT_DPREC; _hibheader.flags = HibernationHeader::Flags((uchar)flags); // Read session password if(_file->read(buf, 2) != 2) return NOT_DPREC; quint16 passwdLen = qFromBigEndian<quint16>((const uchar*)buf); _hibheader.password = _file->read(passwdLen); if(_hibheader.password.length() != passwdLen) return NOT_DPREC; } _beginning = _file->pos(); if(_isHibernation) { // Compatibility check is simple for hibernation files: we only need to look at the major version if(DRAWPILE_PROTO_MAJOR_VERSION == majorVersion(_formatversion)) return COMPATIBLE; else return INCOMPATIBLE; } else { // Compatability check for normal recordings const quint32 myversion = version32(DRAWPILE_PROTO_MAJOR_VERSION, DRAWPILE_PROTO_MINOR_VERSION); // Best case: exact version match if(myversion == _formatversion) return COMPATIBLE; // A recording made with a newer (major) version may contain unsupported commands. if(majorVersion(myversion) < majorVersion(_formatversion)) return UNKNOWN_COMPATIBILITY; // Newer minor version: expect rendering differences if(myversion < _formatversion) return MINOR_INCOMPATIBILITY; // Old versions known to be compatible switch(_formatversion) { case version32(11, 3): // we have compatibility code for these versions case version32(11, 2): return COMPATIBLE; } // Other versions are not supported return INCOMPATIBLE; } }
int DhQHttpRequestHeader::DvhmajorVersion() const { return majorVersion(); }
// // SUMMARY: 拡張取得プロパティ系メソッド // KTL_INLINE NativeOSVersion::flag_type NativeOSVersion::versionFlag() { return majorVersion() * 0x100 + minorVersion(); }
int DhQHttpResponseHeader::DvhmajorVersion() const { return majorVersion(); }
/*! \brief Returns meta information for a property. An invalid PropertyMetaInfo object if the given property name is unknown. \throws InvalidMetaInfoException if the object is not valid */ PropertyMetaInfo NodeMetaInfo::property(const QString &propertyName, bool resolveDotSyntax) const { if (!isValid()) { qWarning() << "NodeMetaInfo is invalid"; return PropertyMetaInfo(); } if (resolveDotSyntax && propertyName.contains('.')) { const QStringList nameParts = propertyName.split('.'); NodeMetaInfo nodeInfo = *this; const int partCount = nameParts.size(); for (int i = 0; i < partCount; ++i) { const QString namePart(nameParts.at(i)); const PropertyMetaInfo propInfo = nodeInfo.property(namePart, false); if (!propInfo.isValid()) break; if (i + 1 == partCount) return propInfo; QString propertyType = propInfo.type(); if (propertyType.right(1) == "*") propertyType = propertyType.left(propertyType.size() - 1).trimmed(); nodeInfo = m_data->metaInfo.nodeMetaInfo(m_data->metaInfo.fromQtTypes(propertyType), majorVersion(), minorVersion()); if (!nodeInfo.isValid()) { qWarning() << "no type info available for" << propertyType; break; } } return PropertyMetaInfo(); } else { PropertyMetaInfo propertyMetaInfo; if (hasLocalProperty(propertyName)) { propertyMetaInfo = m_data->propertyMetaInfoHash.value(propertyName, PropertyMetaInfo()); } else { foreach (const NodeMetaInfo &superTypeMetaInfo, superClasses()) { Q_ASSERT(superTypeMetaInfo.isValid()); propertyMetaInfo = superTypeMetaInfo.property(propertyName); if (propertyMetaInfo.isValid()) break; } } return propertyMetaInfo; }
/*! \brief Returns meta information for all dot properties, including properties inherited from base types. */ QHash<QString,PropertyMetaInfo> NodeMetaInfo::dotProperties() const { if (!isValid()) { qWarning() << "NodeMetaInfo is invalid"; return QHash<QString,PropertyMetaInfo>(); } QHash<QString,PropertyMetaInfo> propertiesInfo; foreach (const QString &propertyName, properties().keys()) { if (property(propertyName).hasDotSubProperties()) { QString propertyType = property(propertyName).type(); if (propertyType.right(1) == "*") propertyType = propertyType.left(propertyType.size() - 1).trimmed(); NodeMetaInfo nodeInfo(m_data->metaInfo.nodeMetaInfo(m_data->metaInfo.fromQtTypes(propertyType), majorVersion(), minorVersion())); if (nodeInfo.isValid()) { QHashIterator<QString,PropertyMetaInfo> iter(nodeInfo.properties()); while (iter.hasNext()) { iter.next(); if (!propertiesInfo.contains(iter.key()) && iter.key() != "objectName") propertiesInfo.insert(propertyName + '.' + iter.key(), iter.value()); } } } } return propertiesInfo; }
inline bool DeviceInfo::supports(FeatureSet feature_set) const { int version = majorVersion() * 10 + minorVersion(); return version >= feature_set; }
void CollectionShardingState::checkShardVersionOrThrow(OperationContext* opCtx) { const auto optReceivedShardVersion = getOperationReceivedVersion(opCtx, _nss); if (!optReceivedShardVersion) return; const auto& receivedShardVersion = *optReceivedShardVersion; if (ChunkVersion::isIgnoredVersion(receivedShardVersion)) { return; } // An operation with read concern 'available' should never have shardVersion set. invariant(repl::ReadConcernArgs::get(opCtx).getLevel() != repl::ReadConcernLevel::kAvailableReadConcern); const auto metadata = getCurrentMetadata(); const auto wantedShardVersion = metadata->isSharded() ? metadata->getShardVersion() : ChunkVersion::UNSHARDED(); auto criticalSectionSignal = [&] { auto csrLock = CSRLock::lock(opCtx, this); return _critSec.getSignal(opCtx->lockState()->isWriteLocked() ? ShardingMigrationCriticalSection::kWrite : ShardingMigrationCriticalSection::kRead); }(); if (criticalSectionSignal) { // Set migration critical section on operation sharding state: operation will wait for the // migration to finish before returning failure and retrying. auto& oss = OperationShardingState::get(opCtx); oss.setMigrationCriticalSectionSignal(criticalSectionSignal); uasserted(StaleConfigInfo(_nss, receivedShardVersion, wantedShardVersion), str::stream() << "migration commit in progress for " << _nss.ns()); } if (receivedShardVersion.isWriteCompatibleWith(wantedShardVersion)) { return; } // // Figure out exactly why not compatible, send appropriate error message // The versions themselves are returned in the error, so not needed in messages here // StaleConfigInfo sci(_nss, receivedShardVersion, wantedShardVersion); uassert(std::move(sci), str::stream() << "epoch mismatch detected for " << _nss.ns() << ", " << "the collection may have been dropped and recreated", wantedShardVersion.epoch() == receivedShardVersion.epoch()); if (!wantedShardVersion.isSet() && receivedShardVersion.isSet()) { uasserted(std::move(sci), str::stream() << "this shard no longer contains chunks for " << _nss.ns() << ", " << "the collection may have been dropped"); } if (wantedShardVersion.isSet() && !receivedShardVersion.isSet()) { uasserted(std::move(sci), str::stream() << "this shard contains chunks for " << _nss.ns() << ", " << "but the client expects unsharded collection"); } if (wantedShardVersion.majorVersion() != receivedShardVersion.majorVersion()) { // Could be > or < - wanted is > if this is the source of a migration, wanted < if this is // the target of a migration uasserted(std::move(sci), str::stream() << "version mismatch detected for " << _nss.ns()); } // Those are all the reasons the versions can mismatch MONGO_UNREACHABLE; }