Skip to content

Commit

Permalink
Add distributed insert plugin logic (#402)
Browse files Browse the repository at this point in the history
* Add distributed insert plugin logic

* Optimize performance what we can do for now

* Update composer deps

* Fix bugs in distributed insert logic: id generation and improve assign

* Add performance measure for hasMatch on each plugin in debugv mode

* Fix issue with insertion of only one doc

* Use CALL uuid_short for ID generation

* Add support of SQL inserts into distributed tables

* Update buddy-core version

* Improve insert check for SQL

* Fix routing issue to distributed table for bulk of elasticsearch
  • Loading branch information
donhardman authored Jan 9, 2025
1 parent 393d7df commit a42ee30
Show file tree
Hide file tree
Showing 8 changed files with 618 additions and 10 deletions.
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/Lib/QueryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,18 @@ public static function detectPluginPrefixFromRequest(Request $request): string {
$disabledPlugins = static::getDisabledPlugins();
foreach ($list as $prefix => $plugins) {
foreach ($plugins as $plugin) {
$t = microtime(true);
$pluginPrefix = $prefix . ucfirst(Strings::camelcaseBySeparator($plugin['short'], '-'));
/** @var BasePayload<T> $pluginPayloadClass */

$pluginPayloadClass = "$pluginPrefix\\Payload";
$pluginPayloadClass::setParser(static::$sqlQueryParser);
$hasMatch = $pluginPayloadClass::hasMatch($request);
Buddy::debugv('matching: ' . $plugin['short'] . ' - ' . ($hasMatch ? 'yes' : 'no'));
$duration = (int)((microtime(true) - $t) * 1000);
$debugMessage = '[' . $duration . 'ms] matching: ' .
$plugin['short'] . ' - ' .
($hasMatch ? 'yes' : 'no');
Buddy::debugv($debugMessage);
if (!$hasMatch) {
continue;
}
Expand Down
Loading

0 comments on commit a42ee30

Please sign in to comment.