YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
/* This C++ file's header */ #include"./rdb_utils.h"
/* C++ standard header files */ #include <array> #include <sstream> #include <string> #include <vector>
for (; *str; str++) { /* If we found a our starting quote character */ if (*str == quote) { /* If it was escaped ignore it */ if (escape) {
escape = false;
} /* Otherwise we are now outside of the quoted string */ else {
quote = '\0';
}
} /* Else if we are currently inside a quoted string? */ elseif (quote != '\0') { /* If so, check for the escape character */
escape = !escape && *str == '\\';
} /* Else if we found a quote we are starting a quoted string */ elseif (*str == '"' || *str == '\'' || *str == '`') {
quote = *str;
} /* Else we are outside of a quoted string - look for our pattern */ else { if (rdb_compare_strings_ic(str, pattern)) {
*succeeded = true; return str;
}
}
}
// Return the character after the found pattern or the null terminator // if the pattern wasn't found. return str;
}
// If the user requested the id create it and return it if (id != nullptr) {
*id = std::string("");
id->reserve(len); while (len--) {
*id += *start; if (*start++ == quote) {
start++;
}
}
}
/* Convertdataintoahexstringwithoptionalmaximumlength. Ifthedataislargerthanthemaximumlengthtruncateitandappend"..".
*/
std::string rdb_hexdump(constchar *data, const std::size_t data_len, const std::size_t maxsize) { // Count the elements in the string
std::size_t elems = data_len; // Calculate the amount of output needed
std::size_t len = elems * rdb_hex_bytes_per_char;
std::string str;
if (maxsize != 0 && len > maxsize) { // If the amount of output is too large adjust the settings // and leave room for the ".." at the end
elems = (maxsize - 2) / rdb_hex_bytes_per_char;
len = elems * rdb_hex_bytes_per_char + 2;
}
// Reserve sufficient space to avoid reallocations
str.reserve(len);
// Loop through the input data and build the output string for (std::size_t ii = 0; ii < elems; ii++, data++) {
uint8_t ch = (uint8_t)*data;
str += rdb_hexdigit[ch >> 4];
str += rdb_hexdigit[ch & 0x0F];
}
// If we can't fit it all add the ".." if (elems != data_len) {
str += "..";
}
for (auto typ : known_types)
{ if (CompressionTypeSupported(typ))
{ if (compression_methods_buf.size())
compression_methods_buf.append(",");
compression_methods_buf.append(CompressionTypeToString(typ));
}
}
} return compression_methods_buf.c_str();
}
void rdb_persist_corruption_marker() { const std::string &fileName(myrocks::rdb_corruption_marker_file_name()); /* O_SYNC is not supported on windows */ int fd = my_open(fileName.c_str(), O_CREAT | IF_WIN(0, O_SYNC), MYF(MY_WME)); if (fd < 0) { // NO_LINT_DEBUG
sql_print_error( "RocksDB: Can't create file %s to mark rocksdb as " "corrupted.",
fileName.c_str());
} else { // NO_LINT_DEBUG
sql_print_information( "RocksDB: Creating the file %s to abort server " "restarts. Remove this file from the data directory " "after fixing the corruption to recover. ",
fileName.c_str());
}
#ifdef _WIN32 /* A replacement for O_SYNC flag above */ if (fd >= 0)
my_sync(fd, MYF(0)); #endif
int ret = my_close(fd, MYF(MY_WME)); if (ret) { // NO_LINT_DEBUG
sql_print_error("RocksDB: Error (%d) closing the file %s", ret,
fileName.c_str());
}
}
} // namespace myrocks
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.