mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 12:19:56 -05:00
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Performance ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? Yes ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description Currently, each round of the sproc that does create indexes does exactly 1 index build and bails. This means if a single client request queues 4 indexes and the job runs every 2 seconds, it'll take 8 seconds to build all 4 indexes. This is wasteful since we know all 4 indexes up front. Add a loop to the index build process so that multiple indexes can be built without waiting the 2 seconds. As part of this, there were a few places allocating in memory contexts that are unstable across executions. Fix this. Additionally there was a loop that could cause index builds to starve for ~20 mins if it picked the wrong index. Fix this loop too. Finally, Noticed that the version cache does not cache properly if the Major version is 0. Fix this (which can cause perf regressions in DocumentDB).
40 lines
978 B
C
40 lines
978 B
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/utils/version_utils.h
|
|
*
|
|
* Utilities that Provide extension functions to handle version upgrade
|
|
* scenarios.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#include <postgres.h>
|
|
#include "utils/version_utils.h"
|
|
|
|
#ifndef VERSION_UTILS_PRIVATE_H
|
|
#define VERSION_UTILS_PRIVATE_H
|
|
|
|
/*
|
|
* The current Extensions' version.
|
|
* Note Extension versions are of the form
|
|
* <Major>.<Minor>-<Patch>
|
|
*/
|
|
typedef struct ExtensionVersion
|
|
{
|
|
/* The major version of the extension */
|
|
int Major;
|
|
|
|
/* The minor version of the extension */
|
|
int Minor;
|
|
|
|
/* The patch version of the extension */
|
|
int Patch;
|
|
} ExtensionVersion;
|
|
|
|
const char * GetCurrentVersionForLogging(void);
|
|
|
|
bool IsExtensionVersionAtleast(ExtensionVersion extVersion, MajorVersion major, int minor,
|
|
int
|
|
patch);
|
|
#endif
|