1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

Revert "MCOL-5057 Revert "Merge pull request #2326 from drrtuy/MCOL-4912-dev6"" (#2350)

This reverts commit c6d4c2a102.

Co-authored-by: Roman Nozdrin <rnozdrin@mariadb.com>
This commit is contained in:
Roman Nozdrin
2022-04-27 16:07:58 +02:00
committed by GitHub
parent 826a735f53
commit ff7759f71e
25 changed files with 3498 additions and 464 deletions

View File

@@ -1,4 +1,5 @@
/* Copyright (C) 2014 InfiniDB, Inc.
Copyright (C) 2016-2022 MariaDB Corporation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -22,6 +23,7 @@
*/
#include <iostream>
#include <string>
#include <stdlib.h>
#include <rwlock.h>
@@ -32,14 +34,18 @@ char* name;
void usage()
{
cout << "Usage " << name << " which_lock_to_use which_side_to_use lock_or_unlock\n"
<< " which_lock_to_use: 1=VSS 2=ExtentMap 3=FreeList 4=VBBM 5=CopyLocks\n";
std::cout << "Usage " << name << " which_lock_to_use:" << std::endl;
size_t lockId = 0;
for (auto& lockName : RWLockNames)
{
std::cout << " " << lockId++ << "=" << lockName << std::endl;
}
exit(1);
}
int main(int argc, char** argv)
{
uint32_t which_lock; // 1-5
uint32_t which_lock; // 0-6
RWLock* rwlock;
LockState state;
@@ -51,18 +57,35 @@ int main(int argc, char** argv)
if (strlen(argv[1]) != 1)
usage();
which_lock = atoi(argv[1]);
try
{
which_lock = std::stoi(argv[1]);
}
catch (std::exception const& e)
{
std::cerr << "Cannot convert the lock id: " << e.what() << std::endl;
usage();
}
if (which_lock < 1 || which_lock > 5)
if (which_lock >= RWLockNames.size())
usage();
rwlock = new RWLock(0x10000 * which_lock);
state = rwlock->getLockState();
cout << "readers = " << state.reading << endl
<< "writers = " << state.writing << endl
<< "readers waiting = " << state.readerswaiting << endl
<< "writers waiting = " << state.writerswaiting << endl
<< "mutex locked = " << (int)state.mutexLocked << endl;
size_t minLockId = (which_lock > 0) ? which_lock : 1;
size_t maxLockId = (which_lock > 0) ? which_lock : RWLockNames.size() - 1;
for (size_t i = minLockId; i <= maxLockId; ++i)
{
rwlock = new RWLock(0x10000 * i);
state = rwlock->getLockState();
cout << RWLockNames[i] << " RWLock" << std::endl
<< " readers = " << state.reading << std::endl
<< " writers = " << state.writing << std::endl
<< " readers waiting = " << state.readerswaiting << std::endl
<< " writers waiting = " << state.writerswaiting << std::endl
<< " mutex locked = " << (int)state.mutexLocked << std::endl;
delete rwlock;
}
return 0;
}